Skip to content

Commit

Permalink
Merge pull request #1 from TimKingtonFC/consecutive-same-color
Browse files Browse the repository at this point in the history
Don't allow consecutive moves for same color
  • Loading branch information
katie-oh authored Jul 23, 2023
2 parents 0785d2d + d4b39d3 commit b8b319e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ RUN apt-get install -y git

RUN cargo install sgf-render

COPY . .

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

ENTRYPOINT python3 rengobot.py
COPY . .

ENTRYPOINT python3 rengobot.py
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)
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
git+https://github.com/katie-oh/rengobot
sgfmill
python-discord
python-discord

0 comments on commit b8b319e

Please sign in to comment.