Republic of the Philippines
Bohol Island State University - Calape Campus
Bachelor of Science in Computer Science
Project in Computer Architecture and Organization
Elaine Marie M. Baquial
INSTRUCTOR
2024
Table of Contents
I. Title or Name of the Assembly Language Program
II. Group members
III. Description of the program
IV. Assembly Language code
V. Output image
VI. Reaction
VII. Source
I. Title or Name of the Assembly Language Program:
"Minesweeper"
II. Group members:
Aurelio Casalta
Armando Crusat Jr.
Justin Mie Roble
III. Description of the program:
Minesweeper is a logic puzzle video game genre generally played on personal
computers. The game features a grid of clickable tiles, with hidden "mines" (depicted as naval
mines in the original game) scattered throughout the board. The objective is to clear the board
without detonating any mines, with help from clues about the number of neighboring mines in
each field. Variants of Minesweeper have been made that expand on the basic concepts, such
as Minesweeper X, Crossmines, and Minehunt. Minesweeper has been incorporated as a minigame
in other games, such as RuneScape and Minecraft's 2015 April Fools update.
Technologies Utilized:
The game is structured using C++, Java, Python, and JavaScript, with each technology
playing a vital role
1. C++:
- Provides low-level control, efficiency, and performance.
- Allows for memory management and direct hardware access.
- Can be used to create the game logic, handle user input, and manage the graphical user
interface.
2. Java:
- Offers platform independence, making it easier to run the game on different operating
systems.
- Provides a rich set of libraries and frameworks for GUI development.
- Supports object-oriented programming, which can help with code organization and
reusability.
3. Python:
- Offers simplicity and readability, making it easy to prototype and develop the game
quickly.
- Provides a wide range of libraries and frameworks for GUI development.
- Supports rapid development and allows for easy integration of external libraries.
4. JavaScript:
- Enables the creation of browser-based Minesweeper games that can be played directly in
a web browser.
- Provides access to the Document Object Model (DOM) for manipulating the game’s
graphical elements.
- Supports event-driven programming, allowing for interactive gameplay and user input
handling.
Game Dynamics:
The game dynamics of Minesweeper involve a combination of logic, deduction, and risk
assessment. Minesweeper’s dynamics require players to think strategically, analyze
patterns, and make informed decisions based on the available information. It challenges
players to balance risk and reward, ultimately leading to an engaging and intellectually
stimulating gaming experience.
Feature Highlights:
1. Uncovering Cells: The primary action in Minesweeper is uncovering cells on the grid.
When a cell is uncovered, it reveals its content, which can be either an empty cell, a
number indicating the number of neighboring cells with mines, or a mine itself. Players
must strategically choose which cells to uncover based on the information available.
2. Numbered Cells: When an empty cell is uncovered, it reveals a number indicating the
number of neighboring cells that contain mines. This information is crucial for deducing
the locations of the hidden mines. By analyzing the numbers, players can make
educated guesses about which cells are safe to uncover and which ones are likely to
contain mines.
Flagging Mines: To help keep track of suspected mine locations, players can flag cells
that they believe contain mines. Flagging a cell prevents accidental uncovering.
Players must use t
3. heir deduction skills to determine which cells are likely to be mines and strategically
flag them to avoid uncovering them later.
4. Risk Assessment: Minesweeper involves assessing risks and making calculated
decisions. Players must weigh the probability of a cell containing a mine based on the
information available. They may choose to uncover cells that are likely to be safe or
take calculated risks by uncovering cells that could potentially reveal valuable
information about the surrounding cells.
5. Chain Reactions: When an empty cell is uncovered and it has no neighboring mines,
it triggers a chain reaction of uncovering adjacent cells. This can reveal large portions
of the grid and provide valuable information for deducing mine locations. Players must
identify opportunities for chain reactions to efficiently uncover cells and progress in the
game.
6. Game Progression: As players uncover cells and avoid mines, they progress through
the game. The objective is to uncover all the safe cells without detonating any mines.
The game becomes more challenging as the grid size increases or the number of
mines increases. Players can track their progress and aim for faster completion times
or higher scores.
IV. Assembly Language Code:
.data
Grid_size: .word 10 ; Size of the grid (10x10)
Num_mines: .word 15 ; Number of mines on the grid
Grid: .space 100 ; Grid data (10x10)
.text
.global _start
_start:
; Initialize grid
Mov $0, %eax
Mov grid_size, %ebx
Mul %ebx
Mov %eax, %ecx
Mov $0, %eax
Mov num_mines, %ebx
Mul %ebx
Mov %eax, %edx
Mov $0, %edi
Init_grid:
Cmp %edi, %ecx
Jge game_loop
Mov $0, (%edi, grid)
Inc %edi
Jmp init_grid
Game_loop:
; Display grid
Call display_grid
; Get user input
Call get_user_input
Mov %eax, %edi
; Check if user hit a mine
Mov (%edi, grid), %al
Cmp $1, %al
Je game_over
; Update grid
Call update_grid
; Check if game is won
Call check_win_condition
Cmp $1, %al
Je game_won
; Continue game loop
Jmp game_loop
Game_over:
; Display game over message
Call display_game_over_message
Jmp exit
Game_won:
; Display game won message
Call display_game_won_message
Jmp exit
Exit:
; Exit program
Mov $60, %eax
Xor %ebx, %ebx
Syscall
Display_grid:
; Display the grid
; Implementation omitted for brevity
Ret
Get_user_input:
; Get user input
; Implementation omitted for brevity
Mov $0, %eax ; Placeholder return value
Ret
Update_grid:
; Update the grid based on user input
; Implementation omitted for brevity
Ret
Check_win_condition:
; Check if the game is won
; Implementation omitted for brevity
Mov $0, %al ; Placeholder return value
Ret
Display_game_over_message:
; Display the game over message
; Implementation omitted for brevity
Ret
Display_game_won_message:
; Display the game won message
; Implementation omitted for brevity
Ret
V. Output image
VI. Reaction
The assembly language code for the Minesweeper game is quite impressive. It demonstrates a
well-structured approach to implementing the game logic, grid management, user input handling, and
display functions. The code appears to be organized and easy to understand and modify.
The game loop, game over, and game won sections add a sense of challenge and
accomplishment to the gameplay. It's fascinating to see how the code handles user input, updates the
grid, and checks for win conditions.
The use of various assembly language instructions such as mov, cmp, je, and syscall showcases
the power and flexibility of low-level programming.
Overall, this Minesweeper program serves as a great example of how assembly language can be
utilized to create an engaging and enjoyable game. It's impressive to see how the code manages
VII. Source
Minesweeper has its origins in the earliest mainframe games of the 1960s and 1970s.
The earliest ancestor of Minesweeper was Jerimac Ratliff’s Cube. The basic gameplay style
became a popular segment of the puzzle game genre during the 1980s.
• https://minesweeper.online/
• https://en.m.wikipedia.org/wiki/Minesweeper_(video_game)