Book Image

Raspberry Pi Embedded Projects Hotshot

Book Image

Raspberry Pi Embedded Projects Hotshot

Overview of this book

Table of Contents (20 chapters)
Raspberry Pi Mechatronics Projects HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

A brief description of the Connect Four Game AI


In this task, we will discuss the general mechanism of the game. We will discuss the function calls used, game flow, and a general idea of the game mechanism. It would be a good idea to follow this code review along with the game code available in this project.

Prepare for lift off

We are building this arcade game based on the code from Making Games with Python & Pygame by Al Sweigart (http://inventwithpython.com/makinggames.pdf). This book is an interesting read and it should enable us to build our own arcade game (not necessarily the Connect Four game).

Engage thrusters

  1. Let's get started with reviewing the general structure of the game using the flowchart shown in the following diagram:

  2. The first step is to import the modules required to launch and play the game. This includes the pygame, pygame.mixer, piface, and serial modules.

  3. After importing the requisite modules, game parameters such as game difficulty, board size in terms of width and...