# CMPE12, Spring 2012, Section 01: Lab2: TicTacToe Game

## Lab 2: Tic Tac Toe Game

• Please make sure you are attending the correct lab section.
• Check on My UCSC to make sure you are enrolled in a section and which one.

Tutors/TA Review:

• Using the connector to make clean wire routing.
• Using the signal sender and signal receiver tools to do multiple pages.
• Demonstrate the bitmap tool and how it works by looking at the example schematic below.

Lab Objective:

In this second lab, you will be designing a simple Tic-Tac-Toe game.  Here are the specifications:

• Start with the tictactoe.lgi example schematic.  You should save this file to your local folder and use it as a starting template.
• Unzip the file xo.zip into the same directory; these are the graphics for your X and O.
• Simulate the example design, noticing how the O is displayed when you turn the selector to 2, and an X is displayed when the selector is turned to 4.
• You may have to change the Bitmap properties and enter the file name, XO0.bmp.
• Create a 3x3 matrix of these and design the logic to detect X or O winning the game.
• Practice good layout skills by being neat with your wiring and labeling.

This is a fairly easy game to build in logic; you are basically just ANDing and ORing.   The goal is to give you an idea how you can use basic logic to build simple functional units.  Also, it will give you a feeling for how much logic it takes to build things.

Lab Requirements:

You must have the following in your lab:

• A neat and pleasing to the eye game board.
• Logic to detect a match in any row, column, or the 2 diagonals for both the X and O player.
• When a game is won light up an LED with a label for the winner, either X or O.  Thus 2 LEDs at a minimum are required.
• Use the node tool to route wires more neatly.

So, how do you win at Tic-Tac-Toe?  You simply get three in a row, a column or a diagonal.  Use the wires labeled X or O to do this (hint: AND together three in a row).  If you get stuck you can ask the TA/Tutor for more hints.

Extra Credit:

Detect when it is a tie and add some sounds to the system, maybe when moves are made or someone wins/ties.  Be creative.

It is recommended to work in pairs on this lab assignment.

Collaboration: You are NOT allowed to discuss this lab with other students other than your partner on this lab.

Files to Submit:

• Lab2.lgi
• Lab Report
• Any sound files you added

Please ask the tutor or see the class newsgroup for information on how to submit these files.

Check-off: You should demonstrate your lab when it is finished so the TA/tutor can check you off, you will still need to electronically submit your files.

Grading template (total points possible overall: 60):

Doing just the lab is worth at most 50 points, with 10 points extra credit available:

A: 50-45 points.  Have a completely functional game that is neatly laid out

B: 45-40 points.  Has a game that works but is messy and poorly designed

C: 40-35 points.  Game mostly works, has some functional issues or minor glitches

D: 35-30 points.  Game is mostly done but doesn't work correctly

Up to 10 points for extra credit, detecting a tie for +4, and +4 for sound effects for moves or win/tie. An extra +2 is available for extra creativity in the game at the TA's / Tutor's discretion.

Did you...?

___ (5 pts) Have the schematics labeled (name, lab #, title, date, etc)?
___ (5 pts) A neat and pleasing to the eye game board?
___ (10 pts) Logic to detect a match in any row, column, or the 2 diagonals for both the “X” and “O” player.
___ (5 pts) When a game is won light up an LED with a label for the winner, either “X” or “O.  Thus 2 LEDs at a minimum are required.
___ (5 pts) Use the “node” tool to route wires more neatly.
___ (5 pts) Create a 3x3 matrix of these and design the logic to detect “X” or “O” winning the game.
___ (5 pts) Equations / Truth tables
___ (10 pts) Does the game work?

Extra Credit:
___ (+ 10 pts) detecting a tie for +4, and +4 for sound effects for moves or win/tie. An extra +2 is available for extra creativity in the game at the TA's / Tutor's discretion.

Lab write up is worth 50 points.

Happy Designing!!