<commit_before>#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Othello Program
# <NAME>
# Updated from May 29, 2015 - June 26, 2015
#
# Has both basic AI (random decision) as well as
# educated AI (minimax).
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Library import
from tkinter import *
from math import *
from time import *
from random import *
from copy import deepcopy

#Tkinter setup
root = Tk()
screen = Canvas(root, width=500, height=600, background="#444",highlightthickness=0)
screen.pack()

class Board:
	def __init__(self):
		#White goes first (0 is white and player,1 is black and computer)
		self.player = 0
		
		#Initializing an empty board
		self.array = []
		for x in range(8):
			self.array.append([])
			for y in range(8):
				self.array[x].append(None)

		#Initializing center values
		self.array[3][3]="w"
		self.array[3][4]="b"
		self.array[4][3]="b"
		self.array[4][4]="w"

	#Updating the board to the screen
	def update(self):
		for x in range(8):
			for y in range(8):
				#Could replace the circles with images later, if I want
				if self.array[x][y]=="w":
					screen.create_oval(52+50*x,52+50*y,48+50*(x+1),48+50*(y+1),fill="white",outline="white")
				if self.array[x][y]=="b":
					screen.create_oval(52+50*x,52+50*y,48+50*(x+1),48+50*(y+1),fill="black",outline="black")
		#Draw the scoreboard and update the screen
		self.drawScoreBoard()
		screen.update()

	#Moves to position
	def boardMove(self,x,y):
		#Move and update screen
		self.array = move(self.array,x,y)
		self.update()
		
		#Switch Player
		self.player = 1-self.player
		
		#Check if player must pass
		self.passTest()

		#If the computer is AI, make a move
		if self.player==1:
			sleep(0.3)
			self.slightlyLessDumbMove()

	#METHOD: Draws scoreboard to screen
	def drawScoreBoard(self):
		#Deleting prior score elements
		screen.delete("score")

		#Scoring based on number of tiles
		player_score = 0
		computer_score = 0
		for x in range(8):
			for y in range(8):
				if self.array[x][y]=="w":
					player_score+=1
				elif self.array[x][y]=="b":
					computer_score+=1

		#Pushing text to screen
		screen.create_text(0,550,anchor="w", tags="score",font=("Consolas", 50),fill="white",text=player_score)<commit_msg>Talbot Said Increase the Delay<commit_after>#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Othello Program
# <NAME>
# Updated from May 29, 2015 - June 26, 2015
#
# Has both basic AI (random decision) as well as
# educated AI (minimax).
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#Library import
from tkinter import *
from math import *
from time import *
from random import *
from copy import deepcopy

#Tkinter setup
root = Tk()
screen = Canvas(root, width=500, height=600, background="#444",highlightthickness=0)
screen.pack()

class Board:
	def __init__(self):
		#White goes first (0 is white and player,1 is black and computer)
		self.player = 0
		
		#Initializing an empty board
		self.array = []
		for x in range(8):
			self.array.append([])
			for y in range(8):
				self.array[x].append(None)

		#Initializing center values
		self.array[3][3]="w"
		self.array[3][4]="b"
		self.array[4][3]="b"
		self.array[4][4]="w"

	#Updating the board to the screen
	def update(self):
		for x in range(8):
			for y in range(8):
				#Could replace the circles with images later, if I want
				if self.array[x][y]=="w":
					screen.create_oval(52+50*x,52+50*y,48+50*(x+1),48+50*(y+1),fill="white",outline="white")
				if self.array[x][y]=="b":
					screen.create_oval(52+50*x,52+50*y,48+50*(x+1),48+50*(y+1),fill="black",outline="black")
		#Draw the scoreboard and update the screen
		self.drawScoreBoard()
		screen.update()

	#Moves to position
	def boardMove(self,x,y):
		#Move and update screen
		self.array = move(self.array,x,y)
		self.update()
		
		#Switch Player
		self.player = 1-self.player
		
		#Check if player must pass
		self.passTest()

		#If the computer is AI, make a move
		if self.player==1:
			sleep(1.5)
			self.slightlyLessDumbMove()

	#METHOD: Draws scoreboard to screen
	def drawScoreBoard(self):
		#Deleting prior score elements
		screen.delete("score")

		#Scoring based on number of tiles
		player_score = 0
		computer_score = 0
		for x in range(8):
			for y in range(8):
				if self.array[x][y]=="w":
					player_score+=1
				elif self.array[x][y]=="b":
					computer_score+=1

		#Pushing text to screen
		screen.create_text(0,550,anchor="w", tags="score",font=("Consolas", 50),fill="white",text=player_score)
{'fraction_non_alphanumeric': 0.18409854423292274, 'fraction_numerical': 0.03986562150055991, 'mean_word_length': 4.361344537815126, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '590224', 'n_tokens_mistral': 1868, 'n_tokens_neox': 1573, 'n_words': 423}