示例#1
0
int main(int argc, char* argv[])
{
  SnakeGameInfo state;
  Direction d;
  readGameState(state);
  while(state.snakes[state.currentPlayer].alive){
    d = AIMove(state.currentPlayer, state);
    switch(d){
    case Up: std::cout << 'u'; break;
    case Down: std::cout << 'd'; break;
    case Left: std::cout << 'l'; break;
    default: std::cout << 'r'; break;
    }
    std::cout.flush();
    readGameState(state);
  }
  return 0;
}
示例#2
0
int loadGame(string filePrefix) {
	dout << "--- loadGame (started in: " << current_time << ")" << endl;
	dout << " loading game from '" << filePrefix << "'" << endl;
	resetGame();
	if(readStates(filePrefix)) return 1;
	if(readAllScripts(filePrefix)) return 1;
	if(readDialogs(filePrefix)) return 1;
	if(readGameState(filePrefix)) return 1;
	if(readInventory(filePrefix)) return 1;
	if(readHotspots(filePrefix)) return 1;
	if(readScenes(filePrefix)) return 1;
	if(readMainCharacter(filePrefix)) return 1;
	if(readMusic(filePrefix)) return 1;
	soundPlayer.resumeAll();

	dout << "--- End loadGame (ended in: " << current_time << ")" << endl << endl;
	return 0;
}