You Are Here: Home » Game – Entertainment Project Ideas » Connect Four on the Tee-Vee using Atmega32

Connect Four on the Tee-Vee using Atmega32




INTRODUCTION

Hello there!  We developed a game to play Connect 4 (for either one or two players) hooked up through a TV’s video input, using only a simple keypad.  The premise of the game is simple: drop your pieces so you get four in a row in either the horizontal, vertical, or diagonal directions.  For the one player mode we incorporated a complex AI scheme to make the game more challenging.  There is a wide range of functionality that let’s you pick how many players are playing and how difficult you want the computer to play.  We also added sound and the original music from the commercials.  To raise the stakes during one person game play the computer taunts the player.

Connect Four on the Tee-Vee using Atmega32

Connect Four on the Tee-Vee using Atmega32

HIGH LEVEL DESIGN

We chose to implement a Connect Four video game on the television because such a project is easily scalable to meet our abilities.  The project allowed us to be reasonably confident that we could implement a core structure to our program and add features as time, available resources, and our abilities would allow.  The program idea stemmed from a project one of us (Matt) completed as part of a high school computer science project  a simple game implemented in PASCAL.  The idea for color television, which was never implemented, came from a past project, the Psychedelic Snake.  This project also suites our backgrounds quite well as it is software intensive, particularly the AI programming, while remaining relatively light in the hardware programming.

The math for the software portion of the game is relatively simple, while the math for the hardware portion is relatively complex. However, most of the hardware implementation had already been accomplished in previous labs, and thus will not be discussed in great detail here.  Please see the appendices for a more detailed discussion of the hardware background for software generated video.  Possibly the most complex math that occurs in software is ensuring that the state machine which runs the game executes in such a way as to not cause any flicker; however, this was done on an empirical, not theoretical, basis.  Calculations were also made to determine the frequency of the notes which play when the game first boots and is intended to mimic the popular Connect Four theme song, Go For It, Connect Four.

Connect Four on the Tee-Vee using Atmega32

The program uses one state machine for all variations of play, which consist of two players, and three levels of a one-player game.  The states of the state machine (LINK TO A DRAWING HERE) often need to take several frames to execute to eliminate flicker and artifacts, and thus a wait variable is used throughout the program.  The state machine calls one of three functions during a one player game, depending on the level chosen.  In the first level, columns in which to place the checker are chosen at random.  The ability to win or to block an opponents win are checked in level two, with all other moves being random.  The third level uses an array, where each column is represented by a position in the array.   The values in the array correspond to the weights given by the program to a particular column, with the highest value being the most desirable column.  The strategy is somewhat complex, checking a wide range of possibilities.  It is also easily scalable in that other scenarios can be added if necessary.  The AI for this level was developed both empirically (by playing the game and determining good strategies.




<============================>

Project Author

Bruce R. Land, Sr. Lecturer, ECE
[email protected]; 607-255-7994
214 Phillips Hall, Cornell, Ithaca, NY 14853
http://people.ece.cornell.edu/land/
<============================>

 

For more detail: Connect Four on the Tee-Vee

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Water Level Alarm

Description Water Level Alarm is a simple project to detect and alarm once the water level in tank or Aquarium...

Close
Scroll to top