Corrected a couple errors in chess
This commit is contained in:
parent
7ea93f871b
commit
733c2ac009
1 changed files with 5 additions and 3 deletions
|
@ -6,6 +6,7 @@ from .utils import config
|
|||
import random
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class Chess:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
@ -83,13 +84,12 @@ class Chess:
|
|||
else:
|
||||
promotion = None
|
||||
if game.move(piece, position.upper(), position):
|
||||
return MoveStatus.valid:
|
||||
return MoveStatus.valid
|
||||
else:
|
||||
return MoveStatus.invalid
|
||||
except IndexError:
|
||||
return MoveStatus.invalid
|
||||
|
||||
|
||||
def get_game(self, player):
|
||||
"""Provides the game this player is playing, in this server"""
|
||||
server_games = self.games.get(player.server.id, [])
|
||||
|
@ -109,7 +109,7 @@ class Chess:
|
|||
return False
|
||||
|
||||
def start_game(self, player1, player2):
|
||||
game = Game(player1, player2):
|
||||
game = Game(player1, player2)
|
||||
try:
|
||||
self.games[player1.server.id].append(game)
|
||||
except KeyError:
|
||||
|
@ -174,6 +174,8 @@ class Chess:
|
|||
|
||||
# Start the game
|
||||
game = self.start_game(ctx.message.author, player2)
|
||||
player1 = game.challengers.get('white')
|
||||
await self.bot.say("{} you have started a chess game with {}\n\n{} will be white this game, and is going first.\nIf you need information about the notation used to play, run {}help chess".format(ctx.message.author.display_name, player2.display_name, ctx.prefix))
|
||||
|
||||
class MoveStatus(Enum):
|
||||
invalid = 0
|
||||
|
|
Loading…
Reference in a new issue