ES2C4 Computer Architecture and Systems


Module Code:

ES2C4

Module Title:

Computer Architecture and Systems

Assessment Setter:

Dr Sam Agbroko [email protected]

Assessment Weighting:

20%

Submission Deadline:

31 August 2021

Target Learning Outcome:

Represent different types of data in binary and perform arithmetic operations on them.

Create basic C programs.

Feedback:

Brief comments in the feedback textbox on Tabula.


1. Introduction

This assessment is designed to allow you demonstrate your understanding of the concepts presented in the ES2C4 Computer Architecture and Systems module. It will also assess your ability to efficiently use computing resources, represent different types of data in binary and carry out basic arithmetic operations.

All design tasks are to be written in the C programming language only.

You should upload a single .docx folder to Tabula containing your solution to the task below and your entire program.


Task 1

Write a program to record information of television sets in a database as shown in the table below. Each television set has brand, size and UHD information.



(i) Write a function to print out the brand, size, UHD settings of a television set when a user enters the television ID.

(20 marks)

(ii) In not more than 150 words, add a block of comment at the end of your program discussing how your design is efficient in the following areas:

a. Memory

b. Number of instructions

(20 marks)


2. Task 2

Design a version of the popular ‘Snake and Ladders’ game for two players. Further information on the game can be found here. Use a 10 x 10 grid for your game and display the grid on the console window. This is illustrated in Fig. 1.



Each empty box should display the character 250 from the Extended ASCII table found at this webpage. The game should have one snake and one ladder. The ladder is on grid C4 – H4 and represented by the character 186. The snake runs diagonally from I6 - E10 and is represented by the character 245. Each player starts in A1 and progresses to J10. Both A1 and J10 are represented by character 175. Player 1 is represented by character 219 and Player 2 is represented by character 176.

Gameplay:

(i) The game asks the players to enter a number to roll the dice. When it is Player 1’s to play, 1 is entered in the console window while 2 is entered for player 2.

(ii) A dice is rolled by generating a random number between 1 and 6. The game displays the number rolled.

(iii) The player corresponding to the number entered is moved along the grid by the number rolled on the dice.

(iv) If any player reaches the top of the ladder C4, that player is moved to the bottom of the ladder H4. If any player reaches the head of the snake I6 they are returned to E10.

(v) The updated grid is displayed along with the number of times each player has rolled the dice.

(vi) The first player to reach the end J10 wins the game and the winner is displayed.

A screenshot of the game running on the console is shown in Figure 2.


Fig. 2. Snakes and ladder game running displayed in the console window.

(60 marks)