You are on page 1of 6

SIR SYED UNIVERSITY OF ENGINEERING AND

TECHNOLOGY

Computer Engineering Department


Course name: Object Oriented Programming (CE-207L)
Semester: 4th
Section: C
PROJECT REPORT
Project title: Word Guessing Game
Name Roll No
M. Bilal Siddiqui 2021F-BCE-055
Syed Sameer Ahmed 2021F-BCE-087
Zayan Sheikh 2021F-BCE-114
Arsalan 2021F-BCE-226

Submitted to:
Sir Yasir Zaheen

ABSTRACT:
The Word Guessing game project developed for the Computer
Organization And Architecture course is a classic implementation of the
popular arcade game. This project focuses on applying fundamental
concepts of assembly language programming to design and implement
the game. Through the use of different types of operations, the Snake
game demonstrates the principles of assembly programing and provides
an engaging gaming experience. This abstract provides an overview of
the project, highlighting its objectives, design, and key features.
PROBLEM STATEMENT
The goal of this project is to develop a word guessing game that demonstrates understanding of
concepts in computer organization and architecture. The game will challenge players to guess a
hidden word by providing hints and allowing them to input their guesses. The project aims to
enhance knowledge and application of fundamental computer organization and architecture
principles, including memory management, data representation, control flow, and input/output
operations.

The game will be designed to run on a computer system, utilizing the underlying hardware
components and their interactions. By implementing the word guessing game, students will gain
hands-on experience in utilizing computer organization and architecture concepts, such as
registers, memory hierarchy, instruction execution, and addressing modes.

The project will require the following key elements:

Word Generation: Implement an algorithm to randomly select a hidden word from a predefined
list or a dictionary.

User Interface: Create an interactive user interface that allows players to input their guesses and
receive appropriate feedback, such as indicating correct letters and their positions or providing
hints.

Memory Management: Design a memory structure to store the hidden word, player guesses, and
any other necessary data efficiently. Consider the use of different memory types, such as
registers, cache, and main memory.

Control Flow: Implement the logic for managing the game flow, including the initialization of
the game, handling user inputs, updating game state, and determining the end of the game.

Input/Output Operations: Utilize appropriate input/output operations to interact with the user,
such as displaying the game status, receiving user inputs, and presenting the results.

Overall, this project will allow students to apply their understanding of computer organization
and architecture concepts to develop a word guessing game that effectively utilizes the
underlying hardware components. Through this implementation, students will gain a deeper
comprehension of the intricacies of computer systems and their role in supporting software
applications.

METHODOLOGY
The methodology behind that word guessing game project is to use all the directories

we study in this subject and some of that which we studied from google and then make

this project. Which are as follows:

.data: This directive indicates the start of the data section, where the program's initialized and
uninitialized data is defined.

word: .asciiz "MARS": This line defines a null-terminated string named word, which represents
the word to be guessed.

guess: .space 5: This line reserves a block of 5 bytes in memory to store the user's guess.

.text: This directive indicates the start of the program's executable instructions in the text section.

.globl main: This line declares the main entry point of the program.

main:: This label marks the beginning of the main function.

li $v0, 4: This instruction loads the value 4 into the $v0 register, which represents the print string
syscall.

la $a0, prompt: This instruction loads the address of the prompt string into the $a0 register,
which will be used as an argument for the print string syscall.

syscall: This instruction triggers a syscall, specifically the print string syscall, which prints the
game instructions.

li $v0, 8: This instruction loads the value 8 into the $v0 register, which represents the read string
syscall.

la $a0, guess: This instruction loads the address of the guess buffer into the $a0 register, which
will be used as an argument for the read string syscall.

li $a1, 5: This instruction loads the value 5 into the $a1 register, which represents the maximum
number of characters to read.

syscall: This instruction triggers a syscall, specifically the read string syscall, which reads the
user's guess into the guess buffer.

la $t0, guess: This instruction loads the address of the guess buffer into the $t0 register, which
will be used to traverse the guess buffer.

la $t1, word: This instruction loads the address of the word string into the $t1 register, which will
be used to traverse the word to be guessed.

check:: This label marks the start of the loop for checking each character in the guess and word.
lbu $t2, ($t0): This instruction loads a byte from the memory location pointed to by $t0 into the
$t2 register. It retrieves a character from the guess buffer.

lbu $t3, ($t1): This instruction loads a byte from the memory location pointed to by $t1 into the
$t3 register. It retrieves a character from the word.

beqz $t2, end: This instruction checks if the character in the guess buffer is zero (end of string).
If it is, the program jumps to the end label, indicating that the guess is complete.

beq $t2, $t3, correct: This instruction checks if the characters in the guess and word match. If
they do, the program jumps to the correct label.

li $v0, 4: This instruction loads the value 4 into the $v0 register, which represents the print string
syscall.

la $a0, wrong: This instruction loads the address of the wrong string into the $a0 register, which
will be used as an argument for the print string syscall.

syscall: This instruction triggers a syscall, specifically the print string syscall, which prints the
wrong guess message.

j done: This instruction jumps to the done label, which indicates the end of the program.

correct:: This label marks the code executed when the characters in the guess and word match.

addiu $t0, $t0, 1: This instruction increments the $t0 register by 1, effectively moving the guess
buffer pointer to the next character.

addiu $t1, $t1, 1: This instruction increments the $t1 register by 1, effectively moving the word
pointer to the next character.

beqz $t3, win: This instruction checks if the character in the word is zero (end of string). If it is,
the program jumps to the win label, indicating that the entire word has been guessed correctly.

j check: This instruction jumps back to the check label to continue checking the remaining
characters.

win:: This label marks the code executed when the user has successfully guessed the word.

li $v0, 4: This instruction loads the value 4 into the $v0 register, which represents the print string
syscall.

la $a0, congrats: This instruction loads the address of the congrats string into the $a0 register,
which will be used as an argument for the print string syscall.

syscall: This instruction triggers a syscall, specifically the print string syscall, which prints the
congratulations message.

j done: This instruction jumps to the done label, which indicates the end of the program.

end:: This label marks the code executed when the user has finished guessing.
li $v0, 4: This instruction loads the value 4 into the $v0 register, which represents the print string
syscall.

la $a0, sorry: This instruction loads the address of the sorry string into the $a0 register, which
will be used as an argument for the print string syscall.

syscall: This instruction triggers a syscall, specifically the print string syscall, which prints the
sorry message.

done:: This label marks the end of the program.

li $v0, 10: This instruction loads the value 10 into the $v0 register, which represents the exit
syscall.

syscall: This instruction triggers a syscall, specifically the exit syscall, which terminates the
program.

42-45: These lines define the strings used in the program, such as the game instructions, wrong
guess message, congratulations message, and sorry message.

RESULT:
Overall, the project's results highlight a comprehensive understanding of computer

organization and architecture principles and their practical application in developing a

word guessing game. The successful implementation of the game demonstrates

proficiency in key areas such as memory management, control flow, data

representation, and input/output operations. Through this project, a solid foundation in

computer organization and architecture has been established, providing valuable

insights into the interaction between software and hardware components within a

computer system.

You might also like