Make pep8 happier
This commit is contained in:
parent
c9774498e0
commit
fe185631b3
2 changed files with 12 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
|
||||
|
||||
class CustomFormatter(logging.Formatter):
|
||||
|
||||
grey = "\x1b[0;35m"
|
||||
|
|
23
src/game.py
23
src/game.py
|
@ -26,7 +26,7 @@ def parse_aguments():
|
|||
default='random'
|
||||
)
|
||||
|
||||
parser.add_argument('-be',
|
||||
parser.add_argument('-be',
|
||||
'--black-engine',
|
||||
choices=engines_choices,
|
||||
help='black player engine (random)',
|
||||
|
@ -40,7 +40,7 @@ def parse_aguments():
|
|||
default=3,
|
||||
)
|
||||
|
||||
parser.add_argument('-wd',
|
||||
parser.add_argument('-wd',
|
||||
'--white-depth-exploration',
|
||||
help='White player exploration depth (minmax or alphabeta engine)',
|
||||
type=int,
|
||||
|
@ -50,7 +50,7 @@ def parse_aguments():
|
|||
parser.add_argument('-bh',
|
||||
'--black-heuristic-engine',
|
||||
help='Black player heutistic engine',
|
||||
choices= heuristic_choices,
|
||||
choices=heuristic_choices,
|
||||
default='score',
|
||||
)
|
||||
|
||||
|
@ -75,7 +75,7 @@ def parse_aguments():
|
|||
default=True,
|
||||
)
|
||||
|
||||
parser.add_argument('-bt',
|
||||
parser.add_argument('-bt',
|
||||
'--black-player-deepening-time',
|
||||
help='Time interval in seconds for Iterative Deepening - black player',
|
||||
type=int,
|
||||
|
@ -93,7 +93,7 @@ def parse_aguments():
|
|||
help='Weight table for weight based heuristic engines',
|
||||
type=int,
|
||||
nargs=4,
|
||||
default=[-5, 2, 10,25]
|
||||
default=[-5, 2, 10, 25]
|
||||
)
|
||||
|
||||
parser.add_argument('-r',
|
||||
|
@ -188,7 +188,7 @@ if __name__ == '__main__':
|
|||
heuristic_engine[args.black_heuristic_engine](
|
||||
logger, {
|
||||
'weight': args.weight,
|
||||
'size': game.get_board_size()
|
||||
'size': game.get_board_size()
|
||||
}
|
||||
),
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ if __name__ == '__main__':
|
|||
white_time = 0
|
||||
black_time = 0
|
||||
while recursions > 0:
|
||||
while ( not game.is_game_over()):
|
||||
while (not game.is_game_over()):
|
||||
start_time = time.time()
|
||||
if game._nextPlayer == 1:
|
||||
move = bplayer.get_move(game)
|
||||
|
@ -213,7 +213,7 @@ if __name__ == '__main__':
|
|||
# Display informations only id we are not in recurse mode
|
||||
if args.recursions == 1:
|
||||
print("Player {} move: {},{}".format(
|
||||
"Black (X)" if move[0] == 2 else "White (O)",
|
||||
"Black (X)" if move[0] == 2 else "White (O)",
|
||||
move[1],
|
||||
move[2]
|
||||
))
|
||||
|
@ -223,7 +223,7 @@ if __name__ == '__main__':
|
|||
score = game._nbBLACK - game._nbWHITE
|
||||
if score == 0:
|
||||
winner = "No winner"
|
||||
elif score > 0:
|
||||
elif score > 0:
|
||||
winner = "Black"
|
||||
else:
|
||||
winner = "White"
|
||||
|
@ -231,7 +231,7 @@ if __name__ == '__main__':
|
|||
print("\nGAME OVER\n---\nWINNER: {} | black:{} in {:>5}s | white:{} in {:>5}s".format(
|
||||
winner,
|
||||
game._nbBLACK,
|
||||
format(black_time,'4.3f'),
|
||||
format(black_time, '4.3f'),
|
||||
game._nbWHITE,
|
||||
format(white_time, '4.3f')
|
||||
))
|
||||
|
@ -266,7 +266,7 @@ if __name__ == '__main__':
|
|||
print("White: {:>2} | ratio: {:>6} | time: {:>8}s | engine: {}".format(
|
||||
white,
|
||||
white * 100 / numbers,
|
||||
format(total_time_white,'4.3f'),
|
||||
format(total_time_white, '4.3f'),
|
||||
wplayer._get_class_name(),
|
||||
))
|
||||
|
||||
|
@ -277,4 +277,3 @@ if __name__ == '__main__':
|
|||
print("---\nBlack player options: {}\nWhite player options: {}".format(
|
||||
bplayer.options, wplayer.options
|
||||
))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue