Beispiel #1
0
void Game::move() {
	// request move from current player
	thread = new getMoveThread;
	thread->setData(current, board);
	connect(thread, SIGNAL(finished()), SLOT(recieveMove()));
	thread->start(QThread::NormalPriority);
}
Beispiel #2
0
 void multiPlayer() {
        int myMove;
        int oppMove = 0;
	int connect = 0;
	
	// Find other players
	while(!connect) {
		connect = findPlayer();
	}
	
	// NOTE: Need to build something to determine who goes first
	// Compare Xbee ID's perhaps?
	
	// Begin game
	while(!game.gameOver && connect) {
		if(game.turn) {
			// Pick Move
			myMove = pickMove();
			// Send Move
				sendMove(myMove);
			// Receive new score after opponent takes damage
				game.oppScore = recieveScore();
		} else {				
			// Receive player move and take damage
			game.myScore = attack(recieveMove(), game.myScore);
			// Send new score
			sendScore(game.myScore);
		}		
		// Check game status
		game.gameOver = gameStatus();
		!game.turn;
	}
	if (!connect) {
		printBSOD();
	} else {
		printResults();
	}
}