Browse Source

renamed playerCard to ScoreSheet in all files to remove confusion and rewrite the ScoreSheet class.

wes 4 years ago
parent
commit
b2461252ef
5 changed files with 16 additions and 15 deletions
  1. 3 3
      Qwixx/ScoreSheet.cpp
  2. 4 4
      Qwixx/ScoreSheet.h
  3. 4 4
      Qwixx/game.cpp
  4. 4 3
      Qwixx/game.h
  5. 1 1
      Qwixx/toDo.md

+ 3 - 3
Qwixx/playerCard.cpp → Qwixx/ScoreSheet.cpp

@@ -1,5 +1,5 @@
-#include "playerCard.h"
-PlayerCard::PlayerCard(std::string name)
+#include "ScoreSheet.h"
+ScoreSheet::ScoreSheet(std::string name)
 {
     // make 12 boxes for each colored row (not the white ones)
     for(int j = 0; j<white1; j++)
@@ -21,7 +21,7 @@ PlayerCard::PlayerCard(std::string name)
     savedName = name;
     penaltyCount = 0;
 }
-void PlayerCard::newSelection()
+void ScoreSheet::newSelection()
 {
     selection[penalty][0] = 0;
     selection[everyone][row] = -1;

+ 4 - 4
Qwixx/playerCard.h → Qwixx/ScoreSheet.h

@@ -1,13 +1,13 @@
-#ifndef PLAYERCARD
-    #define PLAYERCARD
+#ifndef SCORESHEET
+    #define SCORESHEET
     #include <vector>
     #include "qwixx.h"
     #include <string>
-    class PlayerCard {
+    class ScoreSheet {
         public: 
         std::vector<std::vector<bool>> rowColors;
         int penaltyCount;
-        PlayerCard(std::string);
+        ScoreSheet(std::string);
         std::string savedName;
         bool isTurnDone;
         int score;

+ 4 - 4
Qwixx/game.cpp

@@ -10,7 +10,7 @@ Game::Game() {
 };
 bool Game::addPlayer(std::string name){
     if(NOT_STARTED == state){
-        PlayerCard newplayer(name);
+        ScoreSheet newplayer(name);
         players.push_back(newplayer);
         fprintf (stdout, "added: %s to the game\n", name.c_str());
         return true;
@@ -31,7 +31,7 @@ void Game::score()
         players[i].score = 0;
         // calculate penalty amount
         players[i].score -= players[i].penaltyCount*PENALTY_VALUE;
-        // check each color(row) on playerCard
+        // check each color(row) on ScoreSheet
         for(int j = 0;j <white1;j++)
         {
             int count = 0;
@@ -64,7 +64,7 @@ void Game::score()
         state = FINISHED;
     }
 }
-void Game::turn(PlayerCard activePlayer)
+void Game::turn(ScoreSheet activePlayer)
 {
     // start all players' turns
     for(int i = 0; i <players.size();i++)
@@ -168,5 +168,5 @@ void Game::receive(std::string userInput)
     players[0].selection[active][row] = yellow;
     players[0].selection[active][column] = 11;
     // convert userInput into number
-    // user number to change the boolean on corresponding spot on playerCard
+    // user number to change the boolean on corresponding spot on ScoreSheet
 }

+ 4 - 3
Qwixx/game.h

@@ -2,22 +2,23 @@
     #define GAME
     #include "qwixx.h"
     #include "dice.h"
-    #include "playerCard.h"
+    #include "ScoreSheet.h"
     #include <windows.h>
     class Game {
         public:
-        std::vector<PlayerCard> players;
+        std::vector<ScoreSheet> players;
         std::vector<bool> lockOut;
         int state; 
         Dice dice;
         Game();
-        void turn(PlayerCard activePlayer);
+        void turn(ScoreSheet activePlayer);
         void score();
         std::string send();
         void receive(std::string userInput);
         // rules as methods of game
         bool addPlayer(std::string name);
         // rule for lockout to populate a locked out row so score function can check for locked rows
+
         // rule for being able to lockout a row, check for last box marked off and set condition where the next box has to be higher than that previous box check
     };
 #endif

+ 1 - 1
Qwixx/toDo.md

@@ -26,7 +26,7 @@
 - what is on the file that gets sent back and forth between server and players
 - what goes out to players: per player(48boxes, penalty count), locked off rows, dice roll, game end(when it occurs)
 - (20AUG04) Started working on send function, come back and finish it to denote a 4x12 grid to save checkboxes per row
-- (20AUG06) come back to `// add selection to players' cards` (explain it) to continue with `send/receive` 
+- (20AUG06) come back to `// add selection to players' cards` (kyle-plain it) to continue with `send/receive` 
     - before writing received create the rules that will affect receive function (e.g. which checkboxes are allowed to be clicked)
 - current make process involves compiling all object files from dice, game, playercard to create main.exe which has to be manually linked to these objects. update makefile to support object file code
 - what comes in from players: newest item checked off on row&column (maybe 2) or penalty