Exemple #1
0
 /**
  * @test
  */
 public function a_neutralized_feedback()
 {
     $feedback = new Feedback();
     $feedback->add(Feedback::NEUTRALIZED, new move(1, 1));
     $feedback->add(Feedback::NEUTRALIZED, new move(0, 1));
     $this->assertCount(0, $feedback->getWinners());
     $this->assertCount(0, $feedback->getLosers());
     $this->assertCount(2, $feedback->getNeutralizeds());
 }
Exemple #2
0
 public function play($id, Move $move)
 {
     $feedback = new Feedback();
     foreach ($this->playAnalizes as $analize) {
         $result = $analize->analyze($id, $move);
         $feedback->merge(Feedback::WIN, $result->getWinners());
         $feedback->merge(Feedback::LOSE, $result->getLosers());
         $feedback->merge(Feedback::NEUTRALIZED, $result->getNeutralizeds());
     }
     foreach ($feedback->getWinners() as $winner) {
         $m = $winner->getCoordenates();
         $this->arena[$m['x']][$m['y']] = $id;
     }
     foreach ($feedback->getNeutralizeds() as $neutralized) {
         $m = $neutralized->getCoordenates();
         $this->arena[$m['x']][$m['y']] = '.';
     }
     return $feedback;
 }