diff options
author | RossTheRoss <mstrapp@protonmail.com> | 2021-04-25 14:54:51 -0500 |
---|---|---|
committer | RossTheRoss <mstrapp@protonmail.com> | 2021-04-25 14:54:51 -0500 |
commit | d40e0d02c955e97738615314443704d94219cff4 (patch) | |
tree | 14539c6b942f3293da6fd3dfd3187f5f69c422cc /Not Jack/Algorithm.py | |
parent | Add files via upload (diff) | |
download | csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar.gz csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar.bz2 csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar.lz csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar.xz csci4511w-d40e0d02c955e97738615314443704d94219cff4.tar.zst csci4511w-d40e0d02c955e97738615314443704d94219cff4.zip |
Remove redundant folder
Diffstat (limited to '')
-rw-r--r-- | Not Jack/Algorithm.py | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/Not Jack/Algorithm.py b/Not Jack/Algorithm.py deleted file mode 100644 index de4fbc0..0000000 --- a/Not Jack/Algorithm.py +++ /dev/null @@ -1,67 +0,0 @@ - -class Algo: # A class for defining algorithms used (minimax and alpha-beta pruning) - - def miniMax(State, Ply_num): # Function for the minimax algorithm - - for i in range(State.Current.dimY): - for j in range(State.Current.dimX): - if State.Current.Mat[i][j] == ' ' and (j, i) not in State.children: - State.Make(j, i, True) - if Ply_num < 2: - return (i, j) - - Minimum_Score = 1000 - i = 0 - j = 0 - for k, z in State.children.items(): - Result = Algo.Maximum(z, Ply_num - 1, Minimum_Score) - if Minimum_Score > Result: - Minimum_Score = Result - i = k[0] - j = k[1] - - return (i, j) - - - def Maximum(State, Ply_num, Alpha): # Alpha-beta pruning function for taking care of Alpha values - if Ply_num == 0: - return State.CurrentScore - - for i in range(State.Current.dimY): - for j in range(State.Current.dimX): - if State.Current.Mat[i][j] == ' ' and (j, i) not in State.children: - State.Make(j, i, False) - - Maximum_Score = -1000 - i = 0 - j = 0 - for k, z in State.children.items(): - Result = Algo.Minimum(z, Ply_num - 1, Maximum_Score) - if Maximum_Score < Result: - Maximum_Score = Result - if Result > Alpha: - return Result - - return Maximum_Score - - - def Minimum(State, Ply_num, Beta): # Alpha-beta pruning function for taking care of Beta values - if Ply_num == 0: - return State.CurrentScore - - for i in range(State.Current.dimY): - for j in range(State.Current.dimX): - if State.Current.Mat[i][j] == ' ' and (j, i) not in State.children: - State.Make(j, i, True) - - Minimum_Score = 1000 - i = 0 - j = 0 - for k, z in State.children.items(): - Result = Algo.Maximum(z, Ply_num - 1, Minimum_Score) - if Minimum_Score > Result: - Minimum_Score = Result - if Result < Beta: - return Result - - return Minimum_Score |