Program that print the number of hops, C/C++ Programming

Assignment Help:

You are working for a computer gaming company and have been asked to look at a survival game.  You will be simulating a rabbit stranded on an island, collecting a large number of simulations of their efforts to get off the island.  The island will be simulated by a 7 by 7 grid uniform squares.  It is surrounded, on all four sides, by water, 1 square wide.  The only problem the water is filled with piranhas, but on each side there are three random placed bridges to freedom.  The corners are reachable so there can be bridges there and the rabbit can escape through the corners.  It could be depicted as (the bridges will be randomly placed differently each time the program is executed)

The goal is for the survivor rabbit to get off the island by "hopping" onto one of the bridges to the mainland.  If the rabbit hopps into the water it is eaten.  If the rabbit takes more than 20 hops and is still on the island it starves.  In all cases, either successfully "escaping" or dying in the effort, the program will print the number of hops that particular rabbit took.


(1) Flow Chart

(2) C source file with comments

(3) Executable file or screen capture showing execution

(4) Bonus:

Program runs the number of time the user enters and displays the results in the form: #runs, #escapes (and %), #hopped into the water (and%), #too many hops(and%).

(5) Another Bonus for:

Randomly place and move a fox on the island.  If the rabbit and fox meet the rabbit dies.


(1)  Need to generate random numbers, have a function to do so.

(2) Equate a random number to a direction of hop, example 1 = up, 2 = down

(3) Keep track of rabbit's location (row, column).  If rabbit hops onto a bridge then it has escaped. If it hops into water it dies.

(4) Keep track of total number of hops. If hops = 20 and it's still ont eh island, the rabbit dies

(5) Once above is working put into a loop.

Related Discussions:- Program that print the number of hops

C program for string operations, Aim: To implement a program for following...

Aim: To implement a program for following string operations: Length of String. String Concatenation. Substring (provide start index and length) Find character a

Padovan string , .write a program that counts the number of occurrences of ...

.write a program that counts the number of occurrences of the string in the n-th padovan string p(n)   program in java // aakash , suraj , prem sasi kumar kamaraj college

Stuctrue , To store a date use a structure that contains three members date...

To store a date use a structure that contains three members date, month and year. If the dates are equal then display message “Equal” otherwise “Unequal” Program structure: main()

Fibonacci function by using simple recursive approach, Implement, in rPeANU...

Implement, in rPeANUt, the a Fibonacci function by using the simple recursive approach. The Fibonacci function can be implemented in c as follow: int fib(int x) {   if (x

Write an application to test class integerset, Set of Integers) Create clas...

Set of Integers) Create class IntegerSet. Each IntegerSet object can hold integers in the range 0-100. The set is represented by an array of bools. Array element a[i] is true if in

Recursion, #questiowrite a program to calculate e^x

#questiowrite a program to calculate e^x

Program create a user defined data structure - c++ program, Create a user-d...

Create a user-defined data structure (struct) called Node that represents a node within a linked list where the "data" stored in each node is a pointer to a Car object.    a) Wr

Program for stack over flow vulnerability., Imagine that the server program...

Imagine that the server program is a setuid program owned by the root, then after you penetrate the program with a shell running, you become the ROOT and you can remove the whole f

Want wellness software, Project Description: We are looking to have soft...

Project Description: We are looking to have software that we will use to track employee information regarding our wellness program. We would like the system to be able to follow

What is a recursive function, Question 1 Write a program in ‘C' to check w...

Question 1 Write a program in ‘C' to check whether a given number is even or odd Question 2 Explain while and do... while loop with an example Question 3 Write a program

Write Your Message!

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd