| 
					
				 | 
			
			
				@@ -1,38 +1,24 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include "qwixx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include "dice.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include "playerCard.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#include <windows.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-class Game { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    std::vector<PlayerCard> players; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    std::vector<bool> lockOut; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    int state;  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    Dice dice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void turn(PlayerCard activePlayer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    void score(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // rules as methods of game 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    bool addPlayer(std::string name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "game.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Game::Game() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // set up lockOut 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(int i = 0; i<white1;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         lockOut.push_back(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // set the state of game [how to move from state to state ("game logic?")] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    state = NOT_STARTED; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // dice have been initialized with random seed 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 bool Game::addPlayer(std::string name){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if(NOT_STARTED == state){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PlayerCard newplayer(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         players.push_back(newplayer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        fprintf (stdout, "added: %s to the game", name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fprintf (stdout, "added: %s to the game\n", name.c_str()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        fprintf(stdout, "player %s was not added to the game", name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fprintf(stdout, "player %s was not added to the game\n", name.c_str()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 void Game::score(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // **CALCULATE EACH PLAYERS' SCORE** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -89,3 +75,28 @@ void Game::turn(PlayerCard activePlayer) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // score the cards 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     score(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+std::string Game::send() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    std::string output; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // gernerate text: per player(48boxes, penalty count), locked off rows, dice roll, game end(when it occurs) send it 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // look at each player card  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for(int i = 0; i < players.size(); i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // check each row on the player's card 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for(int j = 0; j < white1; j++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // check each box on the player card and then store output 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for(int k = 0; k < CHECKBOXES;k++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // look at checkbox value, add it to output 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                output.push_back(players[i].rowColors[j][k] ? 'T' : 'F'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fprintf(stdout, "the output is: %s\n", output.c_str()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return output; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+void Game::receive(std::string userInput){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // newest item checked off on row&column (maybe 2) or penalty 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // once data is received, add it to the playerCard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |