Python Miniproject: Making the Game of Go from Scratch in PyGame | by Thomas Hikaru Clark

Picture from Wikimedia Commons (CC BY-SA 4.0)
  • Tips on how to arrange a fundamental sport GUI with PyGame
  • Tips on how to use collections and itertools to jot down concise, elegant code
  • Tips on how to use NumPy operators for quick matrix operations
  • Tips on how to use the Networkx graph library to interrupt down advanced issues

Fast Overview of Go Guidelines

Design Course of

  • Draw the board utilizing PyGame
  • Convert between the (x,y) coordinates of PyGame and the discrete board positions of the 19×19 grid
  • Replace the sport state primarily based on consumer actions (e.g. mouse clicks)
  • Examine if an tried transfer is legitimate

The Code

Making a Primary Sport with PyGame

Display screen Seize from my Go sport.

The Magic of NumPy Operations

Itertools and Collections

Figuring out Stone Teams Utilizing Graph Principle

What number of stone teams of every colour are there?
The sport can now detect the seize of stone teams and replace the board.

Subsequent Steps

References