Пример #1
0
 public function testHasPoint()
 {
     $point = new Point(6, 7);
     $pointCollection = new PointCollection([$point]);
     $this->assertTrue($pointCollection->hasPoint($point));
     $this->asserttrue($pointCollection->hasPoint(new Point(6, 7)));
     $this->assertfalse($pointCollection->hasPoint(new Point(2, 2)));
 }
Пример #2
0
 /**
  * Used to check if game should end
  * @return boolean
  */
 public function isThereNonSunkBattleship()
 {
     foreach ($this->placers as $placer) {
         foreach ($placer->getPoints() as $placerPoint) {
             if (!$this->shots->hasPoint($placerPoint)) {
                 return true;
             }
         }
     }
     return false;
 }