This Gmae uses the following modules of Python -->
- Pygame
- Tkinter
- numpy
- math
- sys
Tkinter is used for starting interval.
pygame is used for creating the main game.
the game is simple it needs two users to play each one will enter the name corresponding to the colour they want.
The one who makes combination of continuous four in any direction wins.
Message will be displayed with name.
So this Algorithm works on Two basic algorithms -- dfs and backtracking
Mini-max algorithm considers all the possible moves that are possible creating a full-fledged tree and assigns branches with certain values depending upon how you assign them like i have given max value to center column as most of the winning moves involve that column.
Then what it do next is pick min and max values on alternate branches of the tree it forms --> take it as it wants to give you less value (winning with less losses) and have the highest value.
Reference if you want to know more -
https://www.youtube.com/watch?v=Ntu8nNBL28o (Hindi)
https://www.youtube.com/watch?v=l-hh51ncgDI (English)
Psedo Code To Aalgo -->
Source - https://en.wikipedia.org/wiki/Minimax
function minimax(node, depth, maximizingPlayer) is
if depth = 0 or node is a terminal node then
return the heuristic value of node
if maximizingPlayer then
value := −∞
for each child of node do
value := max(value, minimax(child, depth − 1, FALSE))
return value
else (* minimizing player *)
value := +∞
for each child of node do
value := min(value, minimax(child, depth − 1, TRUE))
return value
--> Certainly Yes and also No . If you are going to create a matrix too big then it might require better algorithms but if its under 15-20 cells then this algo will work
BETTER ALGO - Alpha - Beta Pruning
--> (branches)^(depth)
# Happy Coding 😁✌