Programming Project COMP1921

You are tasked with creating a basic treasure hunt game in C , where players navigate a map to find  hidden treasures using command-line inputs.
You should design your code to be defensive and handle a range of errors in a graceful way, without crashing unexpectedly. Consider the full range of mistakes which a user could make when trying to run the program.
iuww520iuww520iuww520iuww520iuww520iuww520iuww520iuww520
Treasure Island Game
The game loads a map file, which is provided on the command line in the format:
./island <mapfilepath> <dimension>
A map file can contain:
And is always a square with the width and height dimension which is also provided on the command line.
The game involves the player moving around the island looking for hidden treasure. The player can move using the WASD keys (w/W = up, a/A = left, s/S = down, d/D = right) or display a map using the m/M key.
The locations of the hidden treasure and the starting point should not be shown by the map, these should be showed by blank spaces ‘ ‘.
When the player finds the hidden treasure, they should receive some message telling them how many they have found such as ‘You have found 1 out of 3 hidden treasures’.
When the player has found all 3 hidden treasures, they have won and the game ends successfully.
There is no exit or quit option, so the only way to complete the game is to find all treasures.
Return codes and Outputs to the User
Any outputs such as error messages can be any text you like, as the grader does not read them.
However, there are certain return codes which you have to use:
0 = success (the game was able to run correctly)
1 = argument error (bad number of arguments, or bad dimension)
2 = file error (the file cannot be read – doesn’t exist or no read permissions)
3 = data error (the file is not a valid map)
Where an error could fall into multiple categories, the autograder will accept either – or you can ask me via Teams.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值