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.

Requirements:

(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.

Hints:

(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

Create three classes program in cpp, In this worksheet you are asked to wri...

In this worksheet you are asked to write three classes in C++: Lecture class, Course class and University class. The classes relate to each other in the way that a Course has many

C++ programming, I need help programing this... In this exercise, you will ...

I need help programing this... In this exercise, you will create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local comp

What does extern "c" int func(int *, A: This will turn o_ "name mangling" f...

A: This will turn o_ "name mangling" for func so that one can connect to code compiled by a C compiler.

Stack push pop, 2 flowcharts, pseudocode for each (at least 4 algorithms), ...

2 flowcharts, pseudocode for each (at least 4 algorithms), and code for either a stack or a queuestion..

What is the reward of operator overloading?, A: you can exploit by overload...

A: you can exploit by overloading standard operators on a class, the intuition of the users of that class. This allow users program in the language of the problem domain instead of

Write a Programme that computes the price of portfolio, write a programme t...

write a programme that computes the price of shares and options. do the options in one-period binomial model.

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

Program is to find the maximum from two numbers, Program is to find the max...

Program is to find the maximum from two numbers: Program is to find the maximum from two numbers entered by the user having pointer variable as parameter void main()   {

What are the debugging methods you employ while came across , What are the ...

What are the debugging methods you employ while came across a problem? A: Debugging with tools such as: 1.      DBG, GDB ,Forte, Visual Studio. 2.      Using tusc to trace

Write Your Message!

Captcha
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