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

Password Validation Prgram in C++, Create a .cpp program that verifies the ...

Create a .cpp program that verifies the strength of a password that a user is entering is strong (complex/secure) enough. In the main area of the program, prompt the user to enter

Define the increment and decrement operators in c language, Define the Incr...

Define the Increment and Decrement Operators in c language? C offers two special operators -and ++ called decrement and increment operators respectively and these are unary ope

What is an iterator class?, A: A class which is used to traverse through th...

A: A class which is used to traverse through the objects maintained through a container class. There are _ve categories of iterators: output iterators, input iterators, forward ite

Illustration of grid function, Illustration of Grid function: For illu...

Illustration of Grid function: For illustration, the script below creates two individual figure windows. At First, it clears the figure window. Then, it generates an x vector

Explain concept of object initialization, Object Initialization An obje...

Object Initialization An object of a derived class can be initialized to an object of a base class. If both the classes have similar data members, then no specific constructor

File processing, Write a C++ program doing the following: The program reads...

Write a C++ program doing the following: The program reads from the keyboard the numbers of rows and columns of a 2-D array of integers. Then, it allocates this array (let’s name i

Standard input- output using motorola and intel devices, Talking to IO boar...

Talking to IO boards inside a computer or microcontroller depends upon the principles used by the microprocessor to address physical devices. On Motorola systems all devices connec

Networking program development, Networking program development. 1.ARP pr...

Networking program development. 1.ARP protocol. 2.Switching HUB. 3.wireshark. 4.winpcap library. 5.C++ & MFC. 6.LAN evironment through switch and HUB(static ARP t

Area under curve., find the c program to find area under the curvey=f(x) ...

find the c program to find area under the curvey=f(x)   #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area;

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