コード例 #1
0
 def test_digital(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_DIGITAL)
     self.match(exp)
コード例 #2
0
 def test_restrictive(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSS-S----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_RESTRICTIVE)
     self.match(exp)
コード例 #3
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_permissive(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_PERMISSIVE);
     self.match(exp)
コード例 #4
0
 def test_diamond(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_DIAMOND)
コード例 #5
0
 def test_permissive(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_PERMISSIVE)
     self.match(exp)
コード例 #6
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_diamond(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_DIAMOND);
コード例 #7
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_digital(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_DIGITAL);
     self.match(exp)
コード例 #8
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_restrictive(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------SSSSSSSSSS-S----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_RESTRICTIVE);
     self.match(exp)
コード例 #9
0
ファイル: map.py プロジェクト: sirvaulterscoff/darktower-rl
    def recompute_fov(self):
        try:
            rlfl.fov(self.current.fov_map0, (self.player.x, self.player.y), self.player.fov_range, rlfl.FOV_PERMISSIVE, True, True)
#            libtcod.map_compute_fov(self.current.fov_map, self.player.x, self.player.y, self.player.fov_range, FOV_LIGHT_WALLS,
#                                FOV_ALGORITHM)
        except Exception, e:
            print e
コード例 #10
0
    def show(self):
        # Start by creating a map on which to work
        # We shall import a dummy map to use

        # Import the map
        import tmap
        self.map, self.origos = tmap.MAP
        p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 = self.origos

        # Create the RLFL internal map
        width = len(self.map)
        height = len(self.map[0])
        self.map_number = rlfl.create_map(width, height)

        # We now have a map number representing the
        # internal map in rlfl

        # initialize the map
        for row in range(len(self.map)):
            for col in range(len(self.map[row])):
                if self.map[row][col] != '#':
                    p = (row, col)

                    # Set non-wall grids as open and seen
                    rlfl.set_flag(self.map_number, p, rlfl.CELL_SEEN)
                    rlfl.set_flag(self.map_number, p, rlfl.CELL_OPEN)

        # we now have a map to work on
        # LOS between 1 and 4 on the map above
        have_los = rlfl.los(self.map_number, p1, p2)
        assert (have_los == False)
        # LOS between 2 and 3
        have_los = rlfl.los(self.map_number, p2, p3)
        assert (have_los == True)

        # Measure distance
        dist = rlfl.distance(p1, p4)

        # Plot simple paths
        flags = 0
        # range (-1 for max range)
        r = -1
        path = rlfl.path(self.map_number, p1, p2, rlfl.PATH_BASIC, r, flags,
                         0.0)

        # Or real path A*
        path = rlfl.path(self.map_number, p1, p2, rlfl.PATH_ASTAR, r, flags,
                         7.0)

        # Lets calculate FOV from 3 using recursive shadowcasting
        # with a light source radius of 6
        rlfl.fov(self.map_number, p3, rlfl.FOV_SHADOW, 6)
        self.print_map(p3)

        # Use the scatter function to find a random spot (summon, teleport)
        # Here we want an open cell within range 16 from p
        require_los = False
        ps = rlfl.scatter(self.map_number, p0, 16, rlfl.CELL_OPEN, require_los)
        super(Full_example, self).print_map([], p0, ps)
コード例 #11
0
    def recompute_fov(self):
        try:
            rlfl.fov(self.current.fov_map0, (self.player.x, self.player.y),
                     self.player.fov_range, rlfl.FOV_PERMISSIVE, True, True)
#            libtcod.map_compute_fov(self.current.fov_map, self.player.x, self.player.y, self.player.fov_range, FOV_LIGHT_WALLS,
#                                FOV_ALGORITHM)
        except Exception, e:
            print e
コード例 #12
0
ファイル: full_example.py プロジェクト: IanWitham/rlfl
 def show(self):
     # Start by creating a map on which to work
     # We shall import a dummy map to use
     
     # Import the map
     import tmap
     self.map, self.origos = tmap.MAP
     p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 = self.origos
     
     # Create the RLFL internal map
     width = len(self.map)
     height = len(self.map[0])
     self.map_number = rlfl.create_map(width, height)
     
     # We now have a map number representing the 
     # internal map in rlfl
     
     # initialize the map
     for row in range(len(self.map)):
         for col in range(len(self.map[row])):
             if self.map[row][col] != '#':
                 p = (row, col)
                 
                 # Set non-wall grids as open and seen
                 rlfl.set_flag(self.map_number, p, rlfl.CELL_SEEN) 
                 rlfl.set_flag(self.map_number, p, rlfl.CELL_OPEN)
                 
     # we now have a map to work on
     # LOS between 1 and 4 on the map above
     have_los = rlfl.los(self.map_number, p1, p2)
     assert(have_los == False)
     # LOS between 2 and 3
     have_los = rlfl.los(self.map_number, p2, p3)
     assert(have_los == True)
     
     # Measure distance
     dist = rlfl.distance(p1, p4)
     
     # Plot simple paths
     flags = 0
     # range (-1 for max range)
     r = -1 
     path = rlfl.path(self.map_number, p1, p2, rlfl.PATH_BASIC, r, flags, 0.0)
     
     # Or real path A*
     path = rlfl.path(self.map_number, p1, p2, rlfl.PATH_ASTAR, r, flags, 7.0)
     
     # Lets calculate FOV from 3 using recursive shadowcasting
     # with a light source radius of 6
     rlfl.fov(self.map_number, p3, rlfl.FOV_SHADOW, 6)
     self.print_map(p3) 
     
     # Use the scatter function to find a random spot (summon, teleport)
     # Here we want an open cell within range 16 from p
     require_los = False
     ps = rlfl.scatter(self.map_number, p0, 16, rlfl.CELL_OPEN, require_los)
     super(Full_example, self).print_map([], p0, ps)
コード例 #13
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_shadowcasting(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['---------------------------SSSSSSSSSSS----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['---------------------------SSSSSSSSSSS----------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_SHADOW);
     self.match(exp)
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['---------S--------------------------------------------------'],
         ['--------SSS-------------------------------------------------'],
         ['-------SSS--------------------------------------------------'],
         ['-----SSSSSSS------------------------------------------------'],
         ['-----SSSSSSSS-----------------------------------------------'],
         ['-----SSSSSSS------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[2]
     rlfl.fov(self.map, p, 6, rlfl.FOV_SHADOW);
     self.match(exp)
コード例 #14
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_basic(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['----------------------------SSSSSSS-SS----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['----------------------------S-SSSSS-S-----------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_CIRCULAR);
     self.match(exp)
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['--------SS--------------------------------------------------'],
         ['--------SSS-------------------------------------------------'],
         ['-------SSS--------------------------------------------------'],
         ['-----SSSS-S-------------------------------------------------'],
         ['-----SSSSSSSS-----------------------------------------------'],
         ['-----SSSS-S-------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[2]
     rlfl.fov(self.map, p, 6, rlfl.FOV_CIRCULAR);
     self.match(exp)
コード例 #15
0
 def test_shadowcasting(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['---------------------------SSSSSSSSSSS----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['---------------------------SSSSSSSSSSS----------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_SHADOW)
     self.match(exp)
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['---------S--------------------------------------------------'],
         ['--------SSS-------------------------------------------------'],
         ['-------SSS--------------------------------------------------'],
         ['-----SSSSSSS------------------------------------------------'],
         ['-----SSSSSSSS-----------------------------------------------'],
         ['-----SSSSSSS------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[2]
     rlfl.fov(self.map, p, 6, rlfl.FOV_SHADOW)
     self.match(exp)
コード例 #16
0
 def test_basic(self):
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['----------------------------SSSSSSS-SS----------------------'],
         ['--------------------------SSSSSSSSSSSSS---------------------'],
         ['----------------------------S-SSSSS-S-----------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['-------------------------------SSS--------------------------'],
         ['--------------------------------S---------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[1]
     rlfl.fov(self.map, p, 6, rlfl.FOV_CIRCULAR)
     self.match(exp)
     exp = [
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['--------SS--------------------------------------------------'],
         ['--------SSS-------------------------------------------------'],
         ['-------SSS--------------------------------------------------'],
         ['-----SSSS-S-------------------------------------------------'],
         ['-----SSSSSSSS-----------------------------------------------'],
         ['-----SSSS-S-------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
         ['------------------------------------------------------------'],
     ]
     p = ORIGOS[2]
     rlfl.fov(self.map, p, 6, rlfl.FOV_CIRCULAR)
     self.match(exp)
コード例 #17
0
 def test_input(self):
     algos = [
         rlfl.FOV_PERMISSIVE,
         rlfl.FOV_DIAMOND,
         rlfl.FOV_DIGITAL,
         rlfl.FOV_RESTRICTIVE,
         rlfl.FOV_SHADOW,
         rlfl.FOV_CIRCULAR,
     ]
     test = (
         {
             'm': -1,
             'p': ORIGOS[1],
             'r': 6,
             's': 'Map not initialized'
         },
         {
             'm': 123,
             'p': ORIGOS[1],
             'r': 6,
             's': 'Map not initialized'
         },
         {
             'm': self.map,
             'p': (-1, -1),
             'r': 6,
             's': 'Location out of bounds'
         },
         {
             'm': self.map,
             'p': ORIGOS[1],
             'r': -100000,
             's': 'Illegal radius'
         },
     )
     for a in algos:
         for i in test:
             try:
                 rlfl.fov(i['m'], i['p'], i['r'], a)
             except Exception as e:
                 self.assertEqual(str(e), i['s'])
                 self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>")
             else:
                 self.fail('Expected Exception: %s (%d)' % (i['s'], a))
コード例 #18
0
ファイル: testfov.py プロジェクト: agrue/rlfl
 def test_input(self):
     algos = [
        rlfl.FOV_PERMISSIVE,
        rlfl.FOV_DIAMOND, 
        rlfl.FOV_DIGITAL,
        rlfl.FOV_RESTRICTIVE, 
        rlfl.FOV_SHADOW,
        rlfl.FOV_CIRCULAR, 
     ]
     test = (
         {
             'm': -1,
             'p': ORIGOS[1],
             'r': 6,
             's': 'Map not initialized'
         },
         {
             'm': 123,
             'p': ORIGOS[1],
             'r': 6,
             's': 'Map not initialized'
         },
         {
             'm': self.map,
             'p': (-1, -1),
             'r': 6,
             's': 'Location out of bounds'
         },
         {
             'm': self.map,
             'p': ORIGOS[1],
             'r': -100000,
             's': 'Illegal radius'
         },
     )
     for a in algos:
         for i in test:
             try:
                 rlfl.fov(i['m'], i['p'], i['r'], a);
             except Exception as e:
                 self.assertEqual(str(e), i['s'])
                 self.assertEqual(str(e.__class__), "<class 'rlfl.Error'>")
             else:
                 self.fail('Expected Exception: %s (%d)' % (i['s'], a))
コード例 #19
0
 def show_restrictive(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_RESTRICTIVE,
              light_walls)
     self.print_map(self.origos[p])
コード例 #20
0
 def show_circular(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_CIRCULAR,
              light_walls)
     self.print_map(self.origos[p])
コード例 #21
0
 def show_shadowcasting(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_SHADOW,
              light_walls)
     self.print_map(self.origos[p])
コード例 #22
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_circular(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_CIRCULAR, light_walls);  
     self.print_map(self.origos[p])  
コード例 #23
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_restrictive(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_RESTRICTIVE, light_walls);  
     self.print_map(self.origos[p])  
コード例 #24
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_diamond(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_DIAMOND, light_walls);  
     self.print_map(self.origos[p]) 
コード例 #25
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_shadowcasting(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_SHADOW, light_walls);  
     self.print_map(self.origos[p])    
コード例 #26
0
 def show_permissive(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_PERMISSIVE,
              light_walls)
     self.print_map(self.origos[p])
コード例 #27
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_permissive(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_PERMISSIVE, light_walls);  
     self.print_map(self.origos[p])  
コード例 #28
0
 def show_diamond(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_DIAMOND,
              light_walls)
     self.print_map(self.origos[p])
コード例 #29
0
ファイル: fov_example.py プロジェクト: IanWitham/rlfl
 def show_digital(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_DIGITAL, light_walls);  
     self.print_map(self.origos[p]) 
コード例 #30
0
 def show_digital(self, p, rad, light_walls=True):
     rlfl.fov(self.mapnum, self.origos[p], rad, rlfl.FOV_DIGITAL,
              light_walls)
     self.print_map(self.origos[p])