Skip to content

r-sajal/Python-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Python-Game

This Gmae uses the following modules of Python -->

  1. Pygame
  2. Tkinter
  3. numpy
  4. math
  5. 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.

Some Bits About Mini Max Algorihtm -->

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

Questions -->


1. Any Better Algo ?

--> 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
2. Complexity ?

--> (branches)^(depth)

Any More Try Contacting me - Ready to help you out anytime.


# Happy Coding 😁✌

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages