コード例 #1
0
 /**
  * @param string $question
  * @return bool
  */
 protected function getBooleanAnswer($question)
 {
     $msg = sprintf("%s (y/n)  ", $question);
     $this->ioService->printMessageLine($msg);
     $answer = $this->ioService->fetchInput();
     if (preg_match('/^[yY]/', $answer)) {
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * @param Game   $game
  * @return array (column, row)
  */
 public function getMove(Game $game)
 {
     $move = $this->ioService->fetchInput();
     $coordinates = explode(' ', $move);
     return [$coordinates[0], $coordinates[1]];
 }