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

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.

Posted Date: 2/19/2013 8:13:15 AM | Location : United States







Related Discussions:- Program that print the number of hops, Assignment Help, Ask Question on Program that print the number of hops, Get Answer, Expert's Help, Program that print the number of hops Discussions

Write discussion on Program that print the number of hops
Your posts are moderated
Related Questions
Protected derivation In addition to doing private and public derivations, you may also do a protected derivation. In this situation :   The private members inherited

Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

A: They are following: Const: point out that memory once initialized, must not be modify through a program. Volatile: denote that value in the memory location can be modified

Control Flow The control flow statements are used when it is needed that the flow of the program is to be changed after taking some decision. This control flow statement theref

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

Write a program called plus that will display asterisks in the shape of a plus sign which has the height and width specified by the user. You must only allow entry of an odd numb

There are 3 acceptable answers: "Never," "Rarely "and" When the problem domain cannot be accurately modelled any other way."

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

Q: Name the operators which cannot be overloaded? A:sizeof, ., .*, .->, ::, ?: