aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Shivansh-007 <[email protected]>2021-01-21 14:01:45 +0530
committerGravatar Shivansh-007 <[email protected]>2021-01-21 14:01:45 +0530
commit8175bc0fbe1fad08372a27b1fb340baf8f20062b (patch)
tree309e326079ff2752ac0cbfc0ef4c666a1331af2b
parentAdd ability to get custom tokens from the bot (diff)
Remove redundant code
-rw-r--r--bot/exts/evergreen/connect_four.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/bot/exts/evergreen/connect_four.py b/bot/exts/evergreen/connect_four.py
index 6ae14f53..e6d4b41a 100644
--- a/bot/exts/evergreen/connect_four.py
+++ b/bot/exts/evergreen/connect_four.py
@@ -133,7 +133,6 @@ class Game:
)
player_num = 1 if self.player_active == self.player1 else 2
while True:
- full_column = False
try:
reaction, user = await self.bot.wait_for("reaction_add", check=self.predicate, timeout=30.0)
except asyncio.TimeoutError:
@@ -149,21 +148,15 @@ class Game:
await message.delete()
await self.message.remove_reaction(reaction, user)
- column_num = self.unicode_numbers.index(str(reaction.emoji))
+ column_num = self.unicode_numbers.index(str(reaction.emoji))
column = [row[column_num] for row in self.grid]
for row_num, square in reversed(list(enumerate(column))):
if not square:
self.grid[row_num][column_num] = player_num
- coords = row_num, column_num
- break
- else:
- await self.channel.send(f"Column {column_num + 1} is full. Try again")
- full_column = True
- if not full_column:
- break
- return coords
+ return row_num, column_num
+ message = await self.channel.send(f"Column {column_num + 1} is full. Try again")
def check_win(self, coords: Coordinate, player_num: int) -> bool:
"""Check that placing a counter here would cause the player to win."""