GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 86b96e...4422cd )
by Theo
01:44
created

cant_jump_pieces()   B

Complexity

Conditions 7

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 7

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 7
c 2
b 0
f 0
dl 0
loc 15
rs 7.3333
ccs 12
cts 12
cp 1
crap 7
1
# pylint: disable=W0613
0 ignored issues
show
Coding Style introduced by
This module 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...
2
# allow unused variables so all movement functions can have same parameter definition
3 1
import operator
4
5
6 1
def get_all_potential_end_locations(start, directions, board):
0 ignored issues
show
Coding Style introduced by
This function 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...
7 1
    ends = []
8 1
    for direction in directions:
9 1
        new_start = start
10 1
        location = tuple(map(operator.add, new_start, direction))
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
11 1
        while location in board:
12 1
            ends.append(location)
13 1
            new_start = location
14 1
            location = tuple(map(operator.add, new_start, direction))
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
15 1
    return ends
16
17
18 1
def distance_of_one(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
19 1
    return [x for x in get_one_move_away(start, directions) if x in potential_end_locations]
20
21
22 1
def get_one_move_away(start, directions):
0 ignored issues
show
Coding Style introduced by
This function 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...
23 1
    ret_val = [tuple(map(operator.add, move, start)) for move in directions]
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
24 1
    return ret_val
25
26
27 1
def cant_jump_pieces(board, start, directions, potential_end_locations, player_directionv):
0 ignored issues
show
Coding Style introduced by
This function 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...
28 1
    locations_with_pieces = [location for location in potential_end_locations if location in board and board[location]]
29 1
    for location in locations_with_pieces:
30
        # get a direction from start
31
        # remove all locations beyond location
32 1
        direction = tuple(map(operator.sub, location, start))
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
33 1
        direction = tuple(map(operator.floordiv, direction, (max(direction), max(direction))))
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
34 1
        location_to_remove = location
35 1
        while True:
36 1
            location_to_remove = tuple(map(operator.add, location_to_remove, direction))
0 ignored issues
show
introduced by
Used builtin function 'map'
Loading history...
37 1
            if location_to_remove not in potential_end_locations:
38 1
                break
39
            else:
40 1
                potential_end_locations.remove(location_to_remove)
41 1
    return potential_end_locations
42
43
44 1
def doesnt_land_on_own_piece(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
45 1
    ends = []
46 1
    for end in potential_end_locations:
47 1
        if board[end]:
48 1
            if board[start].color != board[end].color:
49 1
                ends.append(end)
50
        else:
51 1
            ends.append(end)
52 1
    return ends
53
54
55 1
def doesnt_land_on_piece(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
56 1
    return [end for end in potential_end_locations if not board[end]]
57
58
59 1
def ends_on_enemy(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
60 1
    ends = []
61 1
    for end in potential_end_locations:
62 1
        if board[end] is not None and board[end].color != board[start].color:
63 1
            ends.append(end)
64 1
    return ends
65
66
67 1
def directional(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
68 1
    return [end for end in potential_end_locations if is_directional(start, end, player_direction)]
69
70
71 1
def is_directional(start, end, direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
72 1
    direct = True
73 1
    direct = direct and _directional_helper(start[0], end[0], direction[0])
74 1
    direct = direct and _directional_helper(start[1], end[1], direction[1])
75 1
    return direct
76
77
78 1
def _directional_helper(start, end, direct):
0 ignored issues
show
Coding Style introduced by
This function 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...
79 1
    if direct > 0:
80 1
        if end < start:
81 1
            return False
82 1
    elif direct < 0:
83 1
        if end > start:
84 1
            return False
85 1
    return True
86
87
88 1
def first_move(board, start, directions, potential_end_locations, player_direction):
0 ignored issues
show
Coding Style introduced by
This function 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...
89
    return potential_end_locations if board[start].move_count == 0 else []
90