Skip to content

4strium/Game-of-Matches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Matches logo

Game of Matches

Program that allows the user to play (via a TKinter graphical interface) the game of matches. Four modes are available: Player vs. Player, Player vs. Computer (random), Player vs. Computer (algorithmic) and Computer vs. Computer (random).

Principle of the game :

The principle of the game is quite simple, it's a two-player game, initially there are 21 matches which are laid out on a table. In turn, you will have to remove one, two or three matches. BUT BE CAREFUL, whoever removes the last match from the table loses! It's up to you to develop the best strategy to win!

In case of problems, you can directly access the rules of the game in the home page of the game:

Image button of game rules

Games Modes :

The game offers several different game modes whether you are alone or two:

  • Player vs. Player :

You can take turns playing with a friend! The first player will be "Player 1" and the second "Player 2".

  • Player vs. Computer (random) :

This is the game mode that starts if you select the player vs computer mode with the easy difficulty. The robot takes matches randomly (with random module) until there are only 3 or less left, to prevent it from playing "crazy"

  • Player vs. Computer (algorithmic) :

This is the game mode that starts if you select the player vs computer mode with the hard difficulty. The robot here picks matches algorithmically, and logically. Here is the logic code:

if nb_allumettes % 4 == 3:                 
            nb_robot = 2
        elif nb_allumettes % 4 == 2:
            nb_robot = 1
        elif nb_allumettes % 4 == 0:
            nb_robot = 3
        else:
            nb_robot = 1
        if nb_allumettes == 1 :
            messagebox.showinfo("Won ! :)","The robot is forced to take the last match, well done!")
            msg_remerciment()
        canvas.after(3000, suppr_allum_robot_difficile, nb_robot, canvas, root_correspondant)             
  • Computer vs. Computer (random) :

The robots here have exactly the same logic as in the player vs computer simple difficulty mode, i.e. random until there are only 3 matches left.

Technologies used :

I use two very useful and functional modules:

  • Random to completely randomly generate the number of matches taken by the computers.
  • TKinter to create the full GUI! All actions with buttons, animations,...
  • PYinstaller to compact all the external files in the same executable file, this module also allows to run any python program (even with dependencies) on any machine!
  • NSIS to build a simple and efficient installer.

Downloads :

You can access the different versions of the game and download them on the page dedicated to releases.

Description Changes Release date
v1.0.0 Initial version ... Released at 15-05-2022
v1.1.0 Final version Fixed issues #1 #2 #3 & added new features. Released at 24-12-2022

Licence :

Licensed under the GNU General Public License v3.0