Exemplo n.º 1
0
 def testShipsOverlappedError(self):
     with self.assertRaises(ShipsOverLappedError):
             m = MyGrid()
             m.placeShipOnGrid(Ship(2,"dest","DE"), Point([1,1]), Point([2,1]))
             m.placeShipOnGrid(Ship(2,"dest","DE"), Point([1,1]), Point([2,1]))
             m.placeShipOnGrid(Ship(2,"dest","DE"), Point([3,3]), Point([3,4]))
Exemplo n.º 2
0
 def testShipIsDiagonalError(self):
     with self.assertRaises(ShipIsDiagonalError):
         g = MyGrid()
         g.placeShipOnGrid(Ship(), Point([0,0]), Point([1,1]))
Exemplo n.º 3
0
 def testShipPlacementSizeNotSameAsShipSizeError(self):
     with self.assertRaises(ShipPlacementSizeNotSameAsShipSizeError):
         g = MyGrid()
         g.placeShipOnGrid(Ship(),Point([0,0]),Point([0,3]))
Exemplo n.º 4
0
 def __init__(self, teamName="ATeam"):
     self.mygrid = MyGrid()
     self.enemygrid = EnemyGrid()
     self.fleet = Fleet()
     self.teamName = teamName