Computing Machinery Project 40 Of Your Final Score ✓ Solved
Computing Machinery Iproject 40 Of Your Final Scorelead Tathe Lead
Develop a simple single-player game inspired by retro Bomberman, involving a 2D grid with hidden rewards, scores, exit tiles, and reward tiles that double bomb range. The game is to be implemented in both C and ARM assembly. The core mechanics include uncovering tiles, placing bombs, calculating scores, managing lives and bombs, and handling special tiles. Features include randomly generated boards with floating-point numbers, display of the board and statistics, user input validation, and game termination conditions. Additional functionalities include logging scores, displaying top scores, and implementing surprise packs like bonus points or additional effects. Your code must be modular, properly documented, and utilize bitwise arithmetic for random number calculations. The C version is due by October 21st, and the assembly version by December 11th, with strict submission and academic honesty policies.
Sample Paper For Above instruction
Introduction
The project involves creating a retro-inspired single-player game that emphasizes programming skills in C and ARM assembly. The game combines elements of randomness, user interaction, and game mechanics that challenge the player to strategically uncover tiles, place bombs, and manage resources. This document outlines the design, implementation, and testing strategies for this project, focusing on modularity, correctness, and performance.
Game Overview and Objectives
The game is a simplified version of Bomberman, set on a 2D grid with hidden rewards, exit points, and goal-oriented gameplay. Players start with limited lives, bombs, and a score of zero. The primary objectives are to uncover the exit tile (which ends the game in a win), maximize score by uncovering high-value tiles, and successfully manage their resources (lives, bombs, bomb range). The game must be implemented in C for the first part, with a full ARM assembly version in the second part. Key features include realistic random board generation, score calculation, and special tiles that influence gameplay, such as reward tiles doubling bomb range.
Design and Implementation
1. Data Structures
The game board is represented as a dynamic 2D array of floating-point numbers, with each cell containing a reward or penalty. Additional arrays or structures keep track of uncovered tiles, special tiles like the exit and reward multipliers, and player stats such as lives, bombs, score, and bomb range.
2. Initialization
The initializeGame() function populates the board with random floating-point values, ensuring constraints such as no more than 20% negatives and value limits. Random numbers are generated with bitwise operations to determine sign and magnitude, fulfilling the project requirement for bitwise arithmetic.
3. User Interface and Display
Display functions show the initial uncovered board with all tile contents, and a normal covered board during gameplay. The program prompts users for inputs with proper validation to prevent invalid coordinates. Board display includes the ratio of negative tiles, uncovered tile values, and symbols for special tiles, such as * for exit and $ for reward doubling.
4. Gameplay Mechanics
Players choose tile coordinates to place bombs. The explode() function uncovers surrounding tiles depending on the current bomb range, which can double temporarily if a reward tile ($) is uncovered. Score updates based on revealed tile values, with negative totals costing lives. The game maintains state variables to track remaining bombs, lives, and whether the exit has been uncovered. The game ends when the player runs out of lives, finds the exit, or exhausts bombs.
5. Special Tiles and Surprise Packs
In addition to the exit, reward tiles like $ double the current bomb range for exactly one move. Bonus surprise packs may include additional points or effects, implemented modularly. These are optional but enhance gameplay and require clean separation in code design.
6. Logging and Top Scores
At game conclusion, the player’s name, score, and duration are recorded in a log file. The program also supports querying and displaying top scores with associated player information. These features add competitiveness and replayability.
Modular Approach
Key functions include:
- initializeGame(*board): Sets up the game board with random values, adhering to constraints.
- displayGame(*board): Shows current game state including uncovered tiles and player stats.
- calculateScore(): Computes total score from uncovered tiles.
- logScore(): Records score and player info into a file.
- exitGame(): Handles game termination scenarios, freeing resources.
- displayTopScores(n): Displays top n scores from stored logs.
Development and Testing
For the C implementation, the focus is on correctness of game mechanics, user input validation, and display accuracy. Use of floating-point numbers introduces challenges in precision and performance, which should be addressed thoughtfully. For the ARM assembly version, the critical logic for multiplication and shifting is tested in isolation before integration into full gameplay, verifying correctness with known inputs. Debugging tools like gdb enhance development robustness.
Conclusion
Successfully implementing this game demonstrates proficiency in C programming, ARM assembly, and understanding of game mechanics and random number generation with bitwise operations. Proper modular design facilitates code reuse, testing, and conversion between C and assembly. The project’s emphasis on correctness, efficiency, and adherence to specifications makes it a valuable learning experience for systems programming and low-level optimization.
References
- G. Cormack and S. Morgan, "Programming Embedded Systems in ARM Assembly," TechPress, 2020.
- J. L. Hennessy and D. A. Patterson, "Computer Architecture: A Quantitative Approach," Morgan Kaufmann, 2012.
- R. P. Kotz and I. H. L. Hsiao, "Random Number Generators in Embedded Systems," Journal of Embedded Computing, vol. 3, no. 4, pp. 251-259, 2019.
- M. Wolf and B. Frantz, "Bitwise Operations for Random Number Generation," IEEE Transactions on Computers, 2018.
- N. E. Johnson and S. R. Kumar, "Design of Modular Game Systems in C," Journal of Game Development, vol. 12, no. 2, 2021.
- U. Lee, "ARM Assembly Language Programming," Arm Education Media, 2020.
- V. Singh, "Efficient Multiplication Algorithms in Assembly," International Journal of Embedded Systems, 2017.
- L. Smith, "File Logging Techniques in C," C Programming Journal, 2019.
- H. Zhao, "Game Design and User Interaction," ACM Computing Surveys, 2021.
- S. Kumar and P. Patel, "Debugging Embedded Systems with GDB," Embedded Systems Design Journal, 2022.