, , , , , ,

[SOLVED] Bbm103-assignment 2 feeding the rabbit game

$25

File Name: Bbm103-assignment_2_feeding_the_rabbit_game.zip
File Size: 405.06 KB

5/5 - (1 vote)

In this assignment, you will implement a game called Feeding the Rabbit Game. In this game, the rabbit which is placed in a board will move according to the commands and collect points according to the food it eats. The user plays the game by moving the the rabbit denoted by * to horizontally or vertically adjacent cells. The user earns/lose points if he/she move the rabbit to a cell that contains Carrot (C), Apple (A) or Meat (M). The game is over and the rabbit cannot move any more if user can move the rabbit to a cell that contains Poison (P). The board may contain Walls (W). The rabbit cannot break the wall, and if the rabbit is in the cell next to the wall, it remains in the cell where it is, even if commanded to move towards the wall. The user moves the rabbit (*) by giving directions to the computer about which direction it is to be moved. There are four allowed moves: Right (R), Left (L), Up (U), and Down (D). The rabbit can move one cell at a time.If the cell that the rabbit is trying to move is already occupied, i.e., if there is another character there, the rabbit replaces those character with the * character. Moreover, the rabbit cant get out of the board or move into walls. For example, if the rabbit is on the far left and is asked to move to the left, he will not move to left any more. This situation is the same for all directions.In this game, the user will determine the size of the map such as 48, 54, 66 or so on, manually enter the elements into the cells and manually enter directions of movements as a list as exemplified in Section 2.Some rules are listed for scoring as follow:Example board:X W X C XA W X A XC X X W PSymbols on the board and their meanings, *=Rabbit, C=Carrot, A=Apple, P=Poison, M=Meat, W=Wall and X=EmptyIn Figure 1, we show the structure of the user input for feeding map of size 3 3 map. As can be seen, you need to provide the map in the form of a list representing a 2D array.Figure 1: The structure of input for feeding map as a listIn Figure 2, we give the structure of the user input for the movements containing 5 directives about the directions. As for the maps, you need to provide the movements in the form of a list.Figure 2: The structure of input for direction of movements as a listThe specification for the inputs is given below:In the following, we provide several examples demonstrating the format of the inputs you take from the users and the format of the outputs you are expected to generate. In the examples below, the user will only enter the elements that are highlighted in red.Example 1:Please enter feeding map as a list:[[W, X, W, C, X], [A, X, X, A, W], [C, X, X,X, P], [X, X, X, X, X], [X, *, X, X, X]]Please enter direction of movements as a list:[U,U,L,U,L]Your board is:W X W C XA X X A WC X X X PX X X X XX * X X XYour output should be like this:W X W C X* X X A WX X X X PX X X X XX X X X XYour score is: 15Example 2 (Condition: Rabbit dies and cannot move if it eats poison): Please enter feeding map as a list:[[X, X, X, C, X], [A, X, X, A, X], [C, X, X,X, P], [W, X, X, X, X], [W, *, W, X, W]]Please enter direction of movements as a list:[U, U, R, R, R, U, L, U]Your board is:X X X C XA X X A XC X X X PW X X X XYour output should be like this:A X X A XC X X X *W X X X XW X W X WYour score: 0Example 3 (Condition: If the rabbit is on the far left and is asked to move to the left, it will not move to left any more):Please enter feeding map as a list:[[W, X, W, C, X], [A, W, W, A, X], [C, X, X,W, P], [X, *, X, X, X]Please enter direction of movements as a list:[L, L, U, L]Your board is:W X W C XA W W A XC X X W PX * X X XYour output should be like this:W X W C XA W W A X* X X W PX X X X XYour score: 10Example 4 (Condition: if the rabbit is in the cell next to the wall, it remains in the cell where it is, even if commanded to move towards the wall.): Please enter feeding map as a list:[[W, X, W, C, X, X], [M, X, X, A, X, X], [A,W, X, W, P, X], [X, *, W, X, X, X]Please enter direction of movements as a list:[R, R, U, U, U, L, L, U, U, U]Your board is:W X W C X XM X X A X XA W X W P XX * W X X XYour output should be like this:W X W C X X* X X A X XX W X W P XX X W X X XYour score: 0

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Bbm103-assignment 2 feeding the rabbit game
$25