Recreation of HexGame in Pygame. More features will come soon !

Overview

Hex with Pygame

Whats is Hex ?

Historical point of view


Hex as been created in 1942 by a Danish mathematician named Piet Hein. The first commercialization of this game is in 1952. With time, some strategies to win have been seeking. Thus, techniques have been found to consistently win on a 7x7 and 9x9 Board. More recently, in 2019, Facebook succeeds in beating the best player of Hex on a 19x19 board.

What Are the rules of this game ?


First, Hex is a two player game. It's a strategic and abstract board game. Each players have a color, black and white. The cells of the board are made up of hexagons. Hence the name "Hex".The goal for each player is to form a connected path of their stones linking the opposing sides of the board marked by their colors before their opponent similarly connects his or her sides.

Illustration from the Game

In this example, white won because they form a line that is linking the opposite white side. Traditionally, board measure 9x9, 11x11, 13x13 or 17x17.

Some Strategies and tips


Easy and Faster connections

Usually, beginners place their pawns directly next to them to create a connection. But there is a faster way to proceed. If you have 2 pawns that have 2 hexagons in common (1), they can be connected, even if black put a Hexagon in one of them (2) > (3). Example:

Stopping a pawn

Imagine playing black and being in this situation:


How can you stop white ? First play a pawn in front of white's pawn.


Now white is obligate to play at the left if they want to win.


Now that you are in this position you must put white in a situation where they must play near your pion, by playing like that:


Now white as no option:


Last be not the least, play a pawn like the first time


And that's it ! You blocked them.

The program

The algorithm for the Win


How can the algorithm detect if a player has won ?

Step 1:

If there is a pawn on the first line, it would be marked as "solution pawn". If there is no pawn on this line, then, the player can't win

Step 2:

All pawns connected to a solution Pawn becomes Solution pawn. But when a Solution Pawn makes a non-solution pawn to become a solution, then this pawn becomes "past". A past pawn can't be a solution pawn anymore.

Step 3:

If a solution pawn is on the last line, the player won.



This algorithm can be similar to Mathematical induction ("Raisonnement par Rรฉcurrence" in French) in Maths

Other fonctionnalities


Color

You can customize the main color of this game. Just by pressing a button

Languages

Many languages are available. (French ๐Ÿ‡ซ๐Ÿ‡ท , English ๐Ÿ‡บ๐Ÿ‡ธ , Japan ๐Ÿ‡ฏ๐Ÿ‡ต , Korean ๐Ÿ‡ฐ๐Ÿ‡ท , Greek ๐Ÿ‡ฌ๐Ÿ‡ท and Sweden ๐Ÿ‡ธ๐Ÿ‡ช )

Sound/Music

There is an default music made by the author. The volume of the music can be modified from 0.0% to 100.0%

Lenght of the Board

The Lenght of the board can go from 5x5 to 50x50


How to install Python and Pygame ?

Install Python

If Python is not installed on your computer (to verify that, you can do: "python --version" on a Terminal. If you don't know how to access a Terminal you can click here : How to access a Terminal) you can click on this link Installing Python, than click on "Download Python 3.X.X". After that, you can execute this File. A window should appear. At the bottom of the screen, there is a small box where it's written: "Add Python3.X to path". Check this box. After that, click on "Customize Installation". Check all the boxes if they aren't checked and click on "Next". Then, click on "Install". After that, you can close the window

Install Pygame

If you want to check if Python is installed you can open a Terminal and write python --version. Installing Pygame is not difficult. Now you need to open a Terminal if there is none open. And just type py -m pip install pygame. It will take some time for being installed.

Install Hex Game

To install Hex Game you need to download this project as a .zip, then you have to decompress it. After the installation and the decompression, you have to execute it by doing py main.py
โš ๏ธ Make sure that you are in the good Folder when you do that. For example, if the file is on your Desktop you should do cd Desktop. You don't understand what I just said? Path of a file in Windows / Mac. How to use CD: Here (It's the same with Mac) โš ๏ธ

Owner
Main: Python3 Also: HTML/CSS/JS and C#
This repository has the lessons of the gamming programming course

learning-python-game-programming This repository has the lessons of the gamming programming course Na faculdade, estou fazendo a disciplina de program

Mateus Faustino 1 Nov 16, 2021
What games should I design next quarter?

Project1_Next-Quarter-Game-Design-Prediction What games should I design next quarter? ์ƒํ™ฉ : ๊ฒŒ์ž„ํšŒ์‚ฌ ๋ฐ์ดํ„ฐํŒ€ ํ•ฉ๋ฅ˜ ๋ฌธ์ œ : '๋‹ค์Œ ๋ถ„๊ธฐ์— ์–ด๋–ค ๊ฒŒ์ž„์„ ์„ค๊ณ„ํ•ด์•ผํ• ๊นŒ' Data Description N

Jayden Lee(JaeHo Lee) 1 Jul 04, 2022
A zombie game using Kinetic. You can control players using fingers

This is Eden Park's portpolio: Works, projects and practices This repository can be used to show the potential employers to check my works, code and p

Eden Park 4 May 16, 2022
An algorithm to reach a correlated equilibrium in multiplayer games.

Correlatedpy: a python library for distributed learning of correlated equilibrium in multiplayer strategic games. View Demo ยท Report Bug ยท Request Fea

Omar Boufous 2 Feb 01, 2022
Flappy Bird hack using Deep Reinforcement Learning (Deep Q-learning).

Using Deep Q-Network to Learn How To Play Flappy Bird 7 mins version: DQN for flappy bird Overview This project follows the description of the Deep Q

Yen-Chen Lin 6.4k Dec 30, 2022
Solution for automation games play-to-earn

Pillow automation used processing images

Luis Eduardo Camilo 1 Jan 19, 2022
Tic Tac Toe Python Game GUI

Tic Tac Toe is one of the most played games and is the best time killer game that you can play anywhere with just a pen and paper.

Astitva Veer Garg 1 Jan 11, 2022
MCRPC (Minecraft Resource Pack Comparator) checks your resource pack against any version of Minecraft to show resources missing from your pack for that version.

Minecraft Resource Pack Comparator MCRPC checks your resource pack against any version of Minecraft to show resources missing from your pack for that

3 Nov 03, 2022
Automates cubemap generation for Source Engine games.

AutoCube Automates cubemap generation for Source Engine games during compile-time. Download: see the release page Installation Using with CompilePal A

5 Feb 18, 2022
Minecraft.nix - Command line Minecraft launcher managed by nix

minecraft.nix Inspired by this thread, this flake contains derivations of both v

12 Sep 06, 2022
Tic-Tac-Toe Game in python3 Tkinter

Tic Tac Toe Tic-Tac-Toe Game in python3 Tkinter About: Tic Tac Toe or Noughts and Crosses as called in British is a pencil and paper game for two play

Sai Swarup Yakkala 5 Nov 06, 2022
A pygame implementation of John Conway's Game of Life

Game of Life A Pygame Simulation This is a Pygame implementation of the famous Conway's Game of Life. The game features a set of very simple rules: An

1 Jan 06, 2022
Inflitator is a classic doom and wolfenstein3D like game made in Python, using the famous PYGAME module.

INFLITATOR Raycaster INFLITATOR is a raycaster made in Python3 with Pygame. It is a game built on top of a simple engine of the same name. An example

Zanvok Corporation 1 Jan 07, 2022
Python fitting assistant, cross-platform fitting tool for EVE Online

pyfa What is it? Pyfa, short for python fitting assistant, allows you to create, experiment with, and save ship fittings without being in game. Open s

1.4k Dec 22, 2022
A Neural Network based chess engine and GUI made with Python and Tensorflow/Keras.

Haxaw-Chess Haxaw: Haxaw is the Neural Network based chess engine made with Python and Tensorflow/Keras. Also uses the python-chess library. (WIP: Imp

Sarthak Bharadwaj 8 Dec 10, 2022
Termordle - a terminal based wordle clone in python

Termordle - a terminal based wordle clone in python

2 Feb 08, 2022
A very bad wordle solver to help me solve the daily wordle

Wordle Solver A very bad wordle solver to help me solve the daily wordle on https://www.powerlanguage.co.uk/wordle/ TODO list take into account letter

Logan Anderson 4 Feb 03, 2022
KBYD - Simple Bulls and Cows Game

KBYD KBYD - Simple Bulls and Cows Game How to Play KBYD is a simple Bulls and Cows Game. When the game starts, the computer randomly generates 3 to 5

1 Dec 04, 2021
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

23 Dec 25, 2022
Algorithm to solve Wordle correctly 100% of the time within 6 attempts.

WordleSolver ยฉ Zulkarnine, 2022. Algorithm to solve Wordle 100% of the time within 6 attempts. You can go ahead and run main.py to run it for all 2315

Zulkarnine Mahmud 69 Dec 11, 2022