コード例 #1
0
ファイル: world.py プロジェクト: sdp0et/worldengine
 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
コード例 #2
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")
コード例 #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")
コード例 #4
0
ファイル: world.py プロジェクト: kengonakajima/worldengine
 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
コード例 #5
0
ファイル: world.py プロジェクト: woodbury/worldengine
 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
コード例 #6
0
ファイル: world.py プロジェクト: stefan-feltmann/lands
 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