Example #1
0
 def random_land(self):
     x, y = random_point(self.width, self.height)
     if self.ocean[
             y,
             x]:  #TODO: this method should get a safer/quicker way of finding land!
         return self.random_land()
     else:
         return x, y
 def test_random_point(self):
     for seed in [0, 1, 27, 29, 1939, 1982, 2015]:
         random.seed(seed)
         for n in range(10):
             x, y = random_point(100, 200)
             self.assertTrue(x >= 0,  "x is within boundaries")
             self.assertTrue(x < 100, "x is within boundaries")
             self.assertTrue(y >= 0,  "y is within boundaries")
             self.assertTrue(y < 200, "y is within boundaries")
Example #3
0
 def test_random_point(self):
     for seed in [0, 1, 27, 29, 1939, 1982, 2015]:
         random.seed(seed)
         for n in range(10):
             x, y = random_point(100, 200)
             self.assertTrue(x >= 0, "x is within boundaries")
             self.assertTrue(x < 100, "x is within boundaries")
             self.assertTrue(y >= 0, "y is within boundaries")
             self.assertTrue(y < 200, "y is within boundaries")
Example #4
0
 def random_land(self):
     x, y = random_point(self.width, self.height)
     if self.ocean[y, x]:#TODO: this method should get a safer/quicker way of finding land!
         return self.random_land()
     else:
         return x, y
Example #5
0
 def random_land(self):
     x, y = random_point(self.width, self.height)
     if self.ocean[y][x]:
         return self.random_land()
     else:
         return x, y
Example #6
0
 def random_land(self):
     x, y = random_point(self.width, self.height)
     if self.ocean[y][x]:
         return self.random_land()
     else:
         return x, y