Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program you will develop a C# windows application that will allow a user to play an animal simulation game. You will need to

For this program you will develop a C# windows application that will allow a user to play an animal simulation game.

You will need to create a base abstract animal class with an abstract move method and a set of derived concrete classes for: cricket, frog, bird, mouse, snake and hunter. Each animal will move around randomly in a board in a different way and displaying different move behaviors. You are welcome to define the movement behaviors you wish, e.g., cricket will jump one square in the board during each time advance period, while a bird may fly two or three or more, while a hunter is more static waiting to have a bird in sight (assume the hunter can only see up, down, left and right in the board). For ease of implementation you can assume that if an animal moves off the board on the right, it reenters in the left (likewise, left to right, top to bottom and bottom to top). In other words, you can use a modulo function to bound the locations in the board after movement. When another animal is close to a higher animal, it can be eaten or killed (e.g., a frog eats crickets, a hunter kills birds and snakes, a mouse kills frogs, a bird also eats crickets, a snake eats mice and frogs.

Define a board, say 50X50 and display a number of each animal (including hunters) in the board (you can use image files to display each animal in the board) and provide a set of buttons for the user to control each iteration. During each iteration, each animal will move, after the new positions for all animals are set, the lucky ones (have food close by) will eat, the unlucky ones will be eaten or killed. Make sure that two animals do not sit in the same square. Allow the user to set parameters (like, number of each kind of animal, how close food needs to be in order to eat it, etc.) either via menus, buttons, drop down boxes or whatever GUI control you find appropriate.

It should be a fun assignment in which you have to use inheritance, and polymorphism as well as some of the GUI facilities of .NET. Document any assumptions you make (e.g., hunter can kill only neighboring snakes but can kill birds up to N locations away)

EXTRA CREDIT:

(10 Points)

You can use a timer to advance the game (say animals move every X seconds, for example) and provide a next button that will trigger movement from all the animals with the possibility to flip between manual movements using the next button and automated movements using the timer.

(10 Points)

Limit movements to prevent animals to move off the board and re-enter on the other side. E.g., if an animal is in a square on the first row, it can only move left, right or down, but not up.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions