0% found this document useful (0 votes)
1 views

UU Assignment Assembly Programming

The assignment requires students to implement a Tic Tac Toe game in assembly language, focusing on low-level programming skills, memory management, and user interaction. Students must create a 3x3 grid, handle player inputs, check for wins or draws, and maintain game flow until completion. Deliverables include source code, documentation, and test cases, with optional challenges for enhancing the game with AI or graphical representation.

Uploaded by

amarekokebe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

UU Assignment Assembly Programming

The assignment requires students to implement a Tic Tac Toe game in assembly language, focusing on low-level programming skills, memory management, and user interaction. Students must create a 3x3 grid, handle player inputs, check for wins or draws, and maintain game flow until completion. Deliverables include source code, documentation, and test cases, with optional challenges for enhancing the game with AI or graphical representation.

Uploaded by

amarekokebe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Unity University

Computer Organization and Assembly Language Programming


Assignment

Implementing Tic Tac Toe in Assembly Language


This assignment will test your understanding of assembly programming and provide hands-on
experience in writing low-level code to implement a game with basic user interaction.

NOTICE: It is strictly forbidden for a group to bring the same or a modified version of the
others.

Objectives

 To gain experience in low-level programming with assembly.


 To understand memory management, input/output handling, and control flow in
assembly.
 Implement the basic game logic for a Tic Tac Toe game.

Instructions

 You will implement a simple Tic Tac Toe game where two players take turns inputting
their moves, and the game checks for a winner or a draw after every move.
 The game will be played on a 3x3 grid, and players will enter their moves by specifying
the row and column where they want to place their symbol (either 'X' or 'O').
 The program will run in a loop until there is a winner or the game ends in a draw.

Requirements

1. Grid Representation:
o Use a 3x3 grid to represent the Tic Tac Toe board. You may use a 2D array or a
flat array (e.g., 9 elements in a list).
o Print the board to the console after each move.
o The positions on the board should be numbered from 1 to 9, so that players can
choose where to place their symbol (like a keypad).
2. Player Input:
o Players will be prompted to enter a number between 1 and 9 to choose the
position on the grid.
o Check for valid inputs (within the 1-9 range) and ensure the chosen position is
not already occupied.
3. Turn Handling:
o Alternate turns between the two players ('X' and 'O').
o Display whose turn it is after each move.

1
4. Win Checking:
o After each move, check if the player has won. A player wins if they have three of
their symbols in a row, column, or diagonal.
o If a player wins, display the winner and end the game.
5. Draw Checking:
o If all positions are filled and there is no winner, declare a draw.
6. Game Loop:
o The game should continue until there is a winner or a draw. You can achieve this
using a loop that checks the state of the game after each move.

Game Logic Outline

1. Initialize an empty 3x3 grid.


2. Display the grid to the console.
3. Prompt player 'X' for their move.
4. Check if the move is valid (empty spot).
5. Update the grid with player 'X' move.
6. Check if player 'X' wins.
7. If player 'X' doesn’t win, prompt player 'O' for their move and repeat the process.
8. After each move, check if there’s a winner or a draw.

Deliverables

1. Source Code:
o Submit the assembly source code for the game.
o The program must run without errors and function as specified.
2. Documentation:
o Provide brief documentation (comments) in the code explaining each part of the
program.
o Include a description of the input/output and how the game is played.
3. Test Cases:
o Test the game with different input scenarios, including:
 A game that results in a win for player 'X' or player 'O'.
 A game that results in a draw.
 Invalid inputs (e.g., selecting an already occupied spot).

Bonus Challenges (Optional):

1. Computer Player (AI):


o Extend the game to allow player 'O' to be a computer-controlled player using a
basic AI (e.g., random moves).
o This can be done by implementing a simple strategy such as picking the first
available spot or random moves.
2. Graphical Representation:

2
oInstead of printing numbers for positions, you can attempt to draw a simple
graphical representation of the grid on the console using ASCII characters.
3. Improved Input Validation:
o Enhance the input validation to handle out-of-bound inputs, invalid entries, or
the same cell being selected twice.

Evaluation Criteria

 Correct implementation of the game logic (grid, turns, win conditions).


 Effective use of assembly programming concepts (control flow, memory management,
loops).
 Clarity and structure of the code.
 Proper handling of user inputs and display of the game state.
 Use of comments to explain critical sections of code

You might also like