Ejemplo n.º 1
0
char* enter_ATTRACT(GameState& game)
{
  ATTRACT_currentFrame = MIN_OUTPUT_PIN;
  ATTRACT_lastFrame = 0;
  // strobes run on their own, just turn them on.
  lightButton(2, 12);
  lightButton(2, 13);
  return "attract.mp3";
}
Ejemplo n.º 2
0
/*
* Returns true if the game is still going or false if over
*
*/
uint8_t Game::play() {
  if (playerTurn) {
    uint8_t outcome = checkPlayerMove();
    switch (outcome) {
      case 0:
        return true;
      case 1:
        lightButton(*nextMove, 1000);
        nextMove = nextMove + sizeof(uint8_t);
        if (*nextMove == 0) {
          playerTurn = false;
          rnd++;
          b.rainbow(1);
          b.playSong("E5,8,G6,8");
          //TODO Fanfare!
          b.allLedsOff();
          delay(1000);
        }
        return true;
      case 2:
        started = false;
        showGameOver(2000);
        //TODO: sad trombone
        return false;
    }
  } else {
    nextMove = getCPUMoves();
    playerTurn = true;
  }
  return true;
}
Ejemplo n.º 3
0
uint8_t* Game::getCPUMoves() {
  memset(cpuMoves, 0, sizeof(cpuMoves));
  for (size_t i = 0; i < rnd; i++) {
    cpuMoves[i] = random(1,5);
    lightButton(cpuMoves[i], 1000); // TODO: decrease per round?
    delay(1000);
  }
  return cpuMoves;
}