Skip to content

Commit

Permalink
Don't allow consecutive moves for same color
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Kington committed Jun 24, 2023
1 parent dce705c commit 3950dfb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rengobot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import os
import ast
import asyncio
import os
import time
from datetime import datetime, timedelta
import asyncio

import sgfengine

import discord
from discord.ext import commands, tasks

import sgfengine

# import requests
# import raw_input

Expand Down Expand Up @@ -121,6 +121,10 @@ async def play(ctx, arg):
await ctx.send("No two consecutive moves by the same player!")
return

if len(state[i][2])>1 and state[i][2][-2] == user.id and (state[i][1]!="teachers" or colour=="0"):
await ctx.send("No two consecutive same-color moves by the same player!")
return

for j in range(len(state[i][2])):
if (state[i][2][j] == user.id and
datetime.now() - datetime.strptime(state[i][3][j],format) < min_time_player):
Expand Down Expand Up @@ -552,4 +556,4 @@ async def background_task():
# bot.run(token)

# background_task.start()
# bot.run(token)
# bot.run(token)

0 comments on commit 3950dfb

Please sign in to comment.