logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write your Student ID in the C comment at the top of the source code file at line 2. Record the time you start and finish this question in the C comment at lines 4 and 5 in 24-hour time

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Write your Student ID in the C comment at the top of the source code file at line 2.

Record the time you start and finish this question in the C comment at lines 4 and 5 in 24-hour time, for example, a start time of 15:20 represents 3:20 pm.

Read the assessment statement from lines 7 to 12, and indicate your understanding by marking the

[ ] YES or [ ] NO with an upper-case X in the associated box.

Design (using pseudo code), implement (using C) and test (using Visual Studio Enterprise 2017) a simple program where the user moves around a 2-dimensional grid by moving north, east, south, or west. The user must be prompted for their move as a single character input and be able to repeatedly make moves until they choose to quit. The virtual world is limited to a range from -10 to 10 inclusive on each axis. When moving around the user may also encounter hidden treasure!

Declare and define at least three functions in addition to the main function. Do not use global variables!

The program must start as follows with the user located at the (x, y) coordinate of (0, 0):

The user is then able to input their move choice or decide to quit. The program must support upper- and lower-case input.

Moving north and south changes the y-coordinate position. Moving east and west changes the x- coordinate position.

For example, moving north increases the y-coordinate by 1 as follows:

Another example, moving south decreases the y-coordinate by 1 as follows:

Another example, moving east increases the x-coordinate by 1 as follows:

Another example, moving west decreases the x-coordinate by 1 as follows:

when the user inputs an invalid command, the program must behave as follows:

Another example is as follows:

When the user quits, the following message must be displayed:

As the user moves around, they will encounter hidden treasure! The following hidden treasures  must be discoverable by the player at the locations specified.

 

Hidden Treasure:

X Location:

Y Location:

Pirate’s chest

2

3

Golden idol

-5

-3

Precious gemstones

1

-2

Lost artwork

5

2

Your fifth treasure!

You choose!

You choose!

At (2, 3) there is a “pirate’s chest”:

At (-5, -3) there is a “golden idol”:

At (1, -2) there are “precious gemstones”:

At (5, 2) there is a “lost artwork”:

Also, add a fifth treasure of your own design!

Ensure each treasure message is surrounded by * symbols as shown above.

The virtual world also has a boundary. The user cannot move to a position where the x-coordinate or y-coordinate is less than -10 or greater than 10.

When the user tries to go beyond the boundaries of the world, the program must behave as follows:

Another example is as follows:

Ensure each boundary warning message is surrounded by an ASCII art box as shown above.

An example of the completed program, with user input:

Follow good programming standards for code layout whitespace, naming and commenting. Ensure your C source code can successfully compile. Test your program with a variety of input and ensure the resulting program output is as described above.

Question 2:

[WEIGHT: 20 MARKS]

 The Practical Test 2 Visual Studio Project Question2 contains the following source code:

 

1

//

COMP500/ENSE501 Practical Test 2: Question 2

2

//

Student ID:

3

//

 

4

//

Start Time:

5

//

End Time:

6

//

 

7

//

This assessment is entirely my own work and has

8

//

not been submitted in any other course of study.

9

//

I did not consult a third-party when completing

10

//

this assessment. I understand that software that

11

//

detects plagiarism and copying may be used on my

12

//

assignment submission. [ ] YES           [ ] NO

Write your Student ID in the C comment at the top of the source code file at line 2.

Record the time you start and finish this question in the C comment at lines 4 and 5 in 24-hour time, for example, a start time of 15:20 represents 3:20pm.

Read the assessment statement from lines 7 to 12, and indicate your understanding by marking the

[ ] YES or [ ] NO with an upper-case X in the associated box.

REQUIREMENTS:

This program is a letter guessing game where a simple AI opponent generates a secret letter for the user to guess. The user must be able to take turns guessing the secret letter, with the AI responding to the user’s guesses. After successfully guessing, the user must be allowed to play again. The AI must count how many turns the user has taken.

Here is an example of a game in progress where the human user has incorrectly guessed the letter

'M' on their first turn:

When the program starts, it must print the following:

After this, the AI must print the following messages:

Carefully review the first line of the simple AI’s message output above, it contained the following:

...abcdefghijkLmnopqrstuvwxyz...

 This simple AI is somewhat poor, as when it outputs the lower-case alphabet, it also highlights what its randomly chosen secret letter is by making it upper-case! Notice the upper-case 'L'! A keen player may notice this (and a programmer can also use this knowledge when testing their implementation).

Next the game must begin, where the simple AI will prompt the user with the current turn number and for the user to input their guess. The user must then be able to input their single character guess:

Ensure the program accepts both upper- and lower-case input from the user in all input scenarios.

When the user’s response is wrong, the AI must respond appropriately. If the guess comes before the secret letter in the alphabet, the simple AI must respond as follows:

If the guess comes after the secret letter in the alphabet, the AI must respond as follows:

After this, the user must then be prompted to take their next turn, and make another guess:

This pattern of play must continue until the user guesses correctly.

When the user guesses correctly, the AI must respond as follows and prompt the user whether they want to play again, or not, in the following style:

Ensure the “You took” some number of “turns!” is sensitive to plurals, and appropriately includes or excludes the 's' on turns depending on the number of turns taken!

When the user selects “yes” they want to play again, a new round must start:

When the user selects “no”, the following message is displayed before the program exits:

Ensure the final “Thanks for playing” some number of “rounds with me” is sensitive to plurals, and appropriately includes or excludes the 's' on rounds depending on the number of rounds played!

The program must also validate the user’s input.

When the user inputs a digit, the program must respond as follows:

Another example is as follows:

When the user input is not a letter or a digit, the program must respond as follows:

One final requirement is that the simple AI must politely insult the player if they have taken more than 25 guesses at the secret letter as follows:

You must choose a different polite insult to occur after 25 guesses – do not use the example: “There are only 26 letters in the alphabet... are you okay?” – choose your own unique message!

DESIGN, IMPLEMENT, TEST AND DEBUG:

Based upon the program requirements set out above, start by creating a pseudo code design in your

Question2 project’s source code file.

Declare and define at least five functions in addition to the main function. Do not use global variables!

Once you have your pseudo code design, implement your design using C. Finally, robustly test your implementation to ensure it matches the requirements.

Follow good programming standards for code layout whitespace, naming and commenting. Ensure your C source code can successfully compile. Test your program with a variety of input and ensure the resulting program output is as described above.

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

708 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

916 Answers

Hire Me
expert
Husnain SaeedComputer science

940 Answers

Hire Me
expert
Atharva PatilComputer science

785 Answers

Hire Me