Skip to content

Instantly share code, notes, and snippets.

View SudhagarS's full-sized avatar

Sudhagar SudhagarS

View GitHub Profile
def reduce(s):
global value, minimum
l = len(s)
minimum = l
if l == 1:
value = 1
return True
elif l == 2 and s[0] == s[1]:
value = 2
return True
@SudhagarS
SudhagarS / tictactoe.py
Created October 23, 2012 22:17
Tic Tac Toe AI implemented in Python using MiniMax algorithm.
def isWin(board):
"""
GIven a board checks if it is in a winning state.
Arguments:
board: a list containing X,O or -.
Return Value:
True if board in winning state. Else False
"""