Completed
Push — master ( 50c77c...9113f9 )
by Kyle
02:07
created

quick_fov()   B

Complexity

Conditions 6

Size

Total Lines 72

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
dl 0
loc 72
rs 7.5335
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""
2
    Rogue-like map utilitys such as line-of-sight, field-of-view, and path-finding.
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (83/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
3
4
    .. deprecated:: 3.2
5
        The features provided here are better realized in the
6
        :any:`tcod.map` and :any:`tcod.path` modules.
7
"""
8
9
from __future__ import absolute_import
10
11
import itertools as _itertools
12
import math as _math
13
14
import numpy as np
0 ignored issues
show
Configuration introduced by
The import numpy could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
15
16
from tcod import ffi as _ffi
17
from tcod import lib as _lib
18
from tcod import ffi, lib
0 ignored issues
show
Unused Code introduced by
The import ffi was already done on line 16. You should be able to
remove this line.
Loading history...
Unused Code introduced by
The import lib was already done on line 17. You should be able to
remove this line.
Loading history...
Unused Code introduced by
Unused ffi imported from tcod
Loading history...
19
20
import tcod.map
21
import tcod.path
22
import tdl as _tdl
23
from . import style as _style
24
25
_FOVTYPES = {'BASIC' : 0, 'DIAMOND': 1, 'SHADOW': 2, 'RESTRICTIVE': 12,
26
             'PERMISSIVE': 11}
27
28
def _get_fov_type(fov):
29
    "Return a FOV from a string"
30
    oldFOV = fov
0 ignored issues
show
Coding Style Naming introduced by
The name oldFOV does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
31
    fov = str(fov).upper()
32
    if fov in _FOVTYPES:
33
        return _FOVTYPES[fov]
34
    if fov[:10] == 'PERMISSIVE' and fov[10].isdigit() and fov[10] != '9':
35
        return 4 + int(fov[10])
36
    raise _tdl.TDLError('No such fov option as %s' % oldFOV)
37
38
class Map(tcod.map.Map):
39
    """Field-of-view and path-finding on stored data.
40
41
    .. versionchanged:: 4.1
42
        `transparent`, `walkable`, and `fov` are now numpy boolean arrays.
43
44
    .. deprecated:: 3.2
45
        :any:`tcod.map.Map` should be used instead.
46
47
    Set map conditions with the walkable and transparency attributes, this
48
    object can be iterated and checked for containment similar to consoles.
49
50
    For example, you can set all tiles and transparent and walkable with the
51
    following code:
52
53
    Example:
54
        >>> import tdl.map
55
        >>> map_ = tdl.map.Map(80, 60)
56
        >>> map_.transparent[:] = True
57
        >>> map_.walkable[:] = True
58
59
    Attributes:
60
        transparent: Map transparency
61
62
            Access this attribute with ``map.transparent[x,y]``
63
64
            Set to True to allow field-of-view rays, False will
65
            block field-of-view.
66
67
            Transparent tiles only affect field-of-view.
68
        walkable: Map accessibility
69
70
            Access this attribute with ``map.walkable[x,y]``
71
72
            Set to True to allow path-finding through that tile,
73
            False will block passage to that tile.
74
75
            Walkable tiles only affect path-finding.
76
77
        fov: Map tiles touched by a field-of-view computation.
78
79
            Access this attribute with ``map.fov[x,y]``
80
81
            Is True if a the tile is if view, otherwise False.
82
83
            You can set to this attribute if you want, but you'll typically
84
            be using it to read the field-of-view of a :any:`compute_fov` call.
85
    """
86
87
    @property
88
    def transparent(self):
89
        return self._Map__buffer[:,:,0].transpose()
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,0].transpose()
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,0].transpose()
^
Loading history...
Bug introduced by
The Instance of Map does not seem to have a member named _Map__buffer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
90
91
    @property
92
    def walkable(self):
93
        return self._Map__buffer[:,:,1].transpose()
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,1].transpose()
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,1].transpose()
^
Loading history...
Bug introduced by
The Instance of Map does not seem to have a member named _Map__buffer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
94
95
    @property
96
    def fov(self):
97
        return self._Map__buffer[:,:,2].transpose()
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,2].transpose()
^
Loading history...
Coding Style introduced by
Exactly one space required after comma
return self._Map__buffer[:,:,2].transpose()
^
Loading history...
Bug introduced by
The Instance of Map does not seem to have a member named _Map__buffer.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
98
99
    def compute_fov(self, x, y, fov='PERMISSIVE', radius=None,
0 ignored issues
show
Bug introduced by
Arguments number differs from overridden 'compute_fov' method
Loading history...
100
                    light_walls=True, sphere=True, cumulative=False):
0 ignored issues
show
Unused Code introduced by
The argument sphere seems to be unused.
Loading history...
101
        """Compute the field-of-view of this Map and return an iterator of the
102
        points touched.
103
104
        Args:
105
            x (int): Point of view, x-coordinate.
106
            y (int): Point of view, y-coordinate.
107
            fov (Text): The type of field-of-view to be used.
108
109
                Available types are:
110
                'BASIC', 'DIAMOND', 'SHADOW', 'RESTRICTIVE', 'PERMISSIVE',
111
                'PERMISSIVE0', 'PERMISSIVE1', ..., 'PERMISSIVE8'
112
            radius (Optional[int]): Maximum view distance from the point of
113
                view.
114
115
                A value of 0 will give an infinite distance.
116
            light_walls (bool): Light up walls, or only the floor.
117
            sphere (bool): If True the lit area will be round instead of
118
                square.
119
            cumulative (bool): If True the lit cells will accumulate instead
120
                of being cleared before the computation.
121
122
        Returns:
123
            Iterator[Tuple[int, int]]: An iterator of (x, y) points of tiles
124
                touched by the field-of-view.
125
        """
126
        # refresh cdata
127
        if radius is None: # infinite radius
128
            radius = 0
129
        if cumulative:
130
            fov_copy = self.fov.copy()
131
        lib.TCOD_map_compute_fov(
132
            self.map_c, x, y, radius, light_walls, _get_fov_type(fov))
133
        if cumulative:
134
            self.fov[:] |= fov_copy
135
        return zip(*np.where(self.fov))
136
137
138
    def compute_path(self, start_x, start_y, dest_x, dest_y,
139
                     diagonal_cost=_math.sqrt(2)):
140
        """Get the shortest path between two points.
141
142
        Args:
143
            start_x (int): Starting x-position.
144
            start_y (int): Starting y-position.
145
            dest_x (int): Destination x-position.
146
            dest_y (int): Destination y-position.
147
            diagonal_cost (float): Multiplier for diagonal movement.
148
149
                Can be set to zero to disable diagonal movement entirely.
150
151
        Returns:
152
            List[Tuple[int, int]]: The shortest list of points to the
153
                destination position from the starting position.
154
155
            The start point is not included in this list.
156
        """
157
        return tcod.path.AStar(self, diagonal_cost).get_path(start_x, start_y,
158
                                                             dest_x, dest_y)
159
160
    def __iter__(self):
161
        return _itertools.product(range(self.width), range(self.height))
162
163
    def __contains__(self, position):
164
        x, y = position
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
165
        return (0 <= x < self.width) and (0 <= y < self.height)
166
167
168
169
class AStar(tcod.path.AStar):
170
    """An A* pathfinder using a callback.
171
172
    .. deprecated:: 3.2
173
        See :any:`tcod.path`.
174
175
    Before crating this instance you should make one of two types of
176
    callbacks:
177
178
    - A function that returns the cost to move to (x, y)
179
    - A function that returns the cost to move between
180
      (destX, destY, sourceX, sourceY)
181
182
    If path is blocked the function should return zero or None.
183
    When using the second type of callback be sure to set advanced=True
184
185
    Args:
186
        width (int): Width of the pathfinding area (in tiles.)
187
        height (int): Height of the pathfinding area (in tiles.)
188
        callback (Union[Callable[[int, int], float],
189
                        Callable[[int, int, int, int], float]]): A callback
190
            returning the cost of a tile or edge.
191
192
            A callback taking parameters depending on the setting
193
            of 'advanced' and returning the cost of
194
            movement for an open tile or zero for a
195
            blocked tile.
196
        diagnalCost (float): Multiplier for diagonal movement.
197
198
            Can be set to zero to disable diagonal movement entirely.
199
        advanced (bool): Give 2 additional parameters to the callback.
200
201
            A simple callback with 2 positional parameters may not
202
            provide enough information.  Setting this to True will
203
            call the callback with 2 additional parameters giving
204
            you both the destination and the source of movement.
205
206
            When True the callback will need to accept
207
            (destX, destY, sourceX, sourceY) as parameters.
208
            Instead of just (destX, destY).
209
    """
210
211
    class __DeprecatedEdgeCost(tcod.path.EdgeCostCallback):
0 ignored issues
show
Coding Style Naming introduced by
The name __DeprecatedEdgeCost does not conform to the class naming conventions ([A-Z_][a-zA-Z0-9]+$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
212
        _CALLBACK_P = lib._pycall_path_swap_src_dest
213
214
    class __DeprecatedNodeCost(tcod.path.EdgeCostCallback):
0 ignored issues
show
Coding Style Naming introduced by
The name __DeprecatedNodeCost does not conform to the class naming conventions ([A-Z_][a-zA-Z0-9]+$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
215
        _CALLBACK_P = lib._pycall_path_dest_only
216
217
    def __init__(self, width, height, callback,
218
                 diagnalCost=_math.sqrt(2), advanced=False):
219
        if advanced:
220
            cost = self.__DeprecatedEdgeCost(callback, width, height)
221
        else:
222
            cost = self.__DeprecatedNodeCost(callback, width, height)
223
        super(AStar, self).__init__(cost, diagnalCost or 0.0)
224
225
    def get_path(self, origX, origY, destX, destY):
226
        """
227
        Get the shortest path from origXY to destXY.
228
229
        Returns:
230
            List[Tuple[int, int]]: Returns a list walking the path from orig
231
                to dest.
232
233
                This excludes the starting point and includes the destination.
234
235
                If no path is found then an empty list is returned.
236
        """
237
        return super(AStar, self).get_path(origX, origY, destX, destY)
238
239
def quick_fov(x, y, callback, fov='PERMISSIVE', radius=7.5, lightWalls=True,
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name lightWalls does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
240
              sphere=True):
241
    """All field-of-view functionality in one call.
242
243
    Before using this call be sure to make a function, lambda, or method that takes 2
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (85/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
244
    positional parameters and returns True if light can pass through the tile or False
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (86/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
245
    for light-blocking tiles and for indexes that are out of bounds of the
246
    dungeon.
247
248
    This function is 'quick' as in no hassle but can quickly become a very slow
249
    function call if a large radius is used or the callback provided itself
250
    isn't optimized.
251
252
    Always check if the index is in bounds both in the callback and in the
253
    returned values.  These values can go into the negatives as well.
254
255
    Args:
256
        x (int): x center of the field-of-view
257
        y (int): y center of the field-of-view
258
        callback (Callable[[int, int], bool]):
259
260
            This should be a function that takes two positional arguments x,y
261
            and returns True if the tile at that position is transparent
262
            or False if the tile blocks light or is out of bounds.
263
        fov (Text): The type of field-of-view to be used.
264
265
            Available types are:
266
            'BASIC', 'DIAMOND', 'SHADOW', 'RESTRICTIVE', 'PERMISSIVE',
267
            'PERMISSIVE0', 'PERMISSIVE1', ..., 'PERMISSIVE8'
268
        radius (float) Radius of the field-of-view.
269
270
            When sphere is True a floating point can be used to fine-tune
271
            the range.  Otherwise the radius is just rounded up.
272
273
            Be careful as a large radius has an exponential affect on
274
            how long this function takes.
275
        lightWalls (bool): Include or exclude wall tiles in the field-of-view.
276
        sphere (bool): True for a spherical field-of-view.
277
            False for a square one.
278
279
    Returns:
280
        Set[Tuple[int, int]]: A set of (x, y) points that are within the
281
            field-of-view.
282
    """
283
    trueRadius = radius
0 ignored issues
show
Coding Style Naming introduced by
The name trueRadius does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
284
    radius = int(_math.ceil(radius))
285
    mapSize = radius * 2 + 1
0 ignored issues
show
Coding Style Naming introduced by
The name mapSize does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
286
    fov = _get_fov_type(fov)
287
288
    setProp = _lib.TCOD_map_set_properties # make local
0 ignored issues
show
Coding Style Naming introduced by
The name setProp does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
289
    inFOV = _lib.TCOD_map_is_in_fov
0 ignored issues
show
Coding Style Naming introduced by
The name inFOV does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
290
291
    tcodMap = _lib.TCOD_map_new(mapSize, mapSize)
0 ignored issues
show
Coding Style Naming introduced by
The name tcodMap does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
292
    try:
293
        # pass no.1, write callback data to the tcodMap
294
        for x_, y_ in _itertools.product(range(mapSize), range(mapSize)):
0 ignored issues
show
Coding Style Naming introduced by
The name x_ does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y_ does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
295
            pos = (x_ + x - radius,
296
                   y_ + y - radius)
297
            transparent = bool(callback(*pos))
298
            setProp(tcodMap, x_, y_, transparent, False)
299
300
        # pass no.2, compute fov and build a list of points
301
        _lib.TCOD_map_compute_fov(tcodMap, radius, radius, radius, lightWalls, fov)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (83/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
302
        touched = set() # points touched by field of view
303
        for x_, y_ in _itertools.product(range(mapSize), range(mapSize)):
0 ignored issues
show
Coding Style Naming introduced by
The name x_ does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y_ does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
304
            if sphere and _math.hypot(x_ - radius, y_ - radius) > trueRadius:
305
                continue
306
            if inFOV(tcodMap, x_, y_):
307
                touched.add((x_ + x - radius, y_ + y - radius))
308
    finally:
309
        _lib.TCOD_map_delete(tcodMap)
310
    return touched
311
312
def bresenham(x1, y1, x2, y2):
0 ignored issues
show
Coding Style Naming introduced by
The name x1 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y1 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name x2 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y2 does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
313
    """
314
    Return a list of points in a bresenham line.
315
316
    Implementation hastily copied from RogueBasin.
317
318
    Returns:
319
        List[Tuple[int, int]]: A list of (x, y) points,
320
            including both the start and end-points.
321
    """
322
    points = []
323
    issteep = abs(y2-y1) > abs(x2-x1)
324
    if issteep:
325
        x1, y1 = y1, x1
326
        x2, y2 = y2, x2
327
    rev = False
328
    if x1 > x2:
329
        x1, x2 = x2, x1
330
        y1, y2 = y2, y1
331
        rev = True
332
    deltax = x2 - x1
333
    deltay = abs(y2-y1)
334
    error = int(deltax / 2)
335
    y = y1
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
336
    ystep = None
337
    if y1 < y2:
338
        ystep = 1
339
    else:
340
        ystep = -1
341
    for x in range(x1, x2 + 1):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
342
        if issteep:
343
            points.append((y, x))
344
        else:
345
            points.append((x, y))
346
        error -= deltay
347
        if error < 0:
348
            y += ystep
0 ignored issues
show
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
349
            error += deltax
350
    # Reverse the list if the coordinates were reversed
351
    if rev:
352
        points.reverse()
353
    return points
354
355
356
quickFOV = _style.backport(quick_fov)
0 ignored issues
show
Coding Style Naming introduced by
The name quickFOV does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
357
AStar.getPath = _style.backport(AStar.get_path)
358