Problem related to the doodlebugs

Assignment Help Basic Computer Science
Reference no: EM131609147

Question: The goal for this programming project is to create a simple 2D predator-prey simulation. In this simulation, the prey is ants, and the predators are doodlebugs. These critters live in a world composed of a 20 20 grid of cells. Only one critter may occupy a cell at a time.

The grid is enclosed, so a critter is not allowed to move off the edges of the grid. Time is simulated in time steps. Each critter performs some action every time step. The ants behave according to the following model:

• Move. Every time step, randomly try to move up, down, left, or right. If the cell in the selected direction is occupied or would move the ant off the grid, then the ant stays in the current cell.

• Breed. If an ant survives for three time steps, then at the end of the third time step (i.e., after moving),the ant will breed. This is simulated by creating a new ant in an adjacent (up, down, left, or right) cell that is empty. If there is no empty cell available, no breeding occurs. Once an offspring is produced, the ant cannot produce an offspring until three more time steps have elapsed.

The doodlebugs behave according to the following model:

• Move. Every time step, if there is an adjacent cell (up, down, left, or right) occupied by an ant, then the doodlebug will move to that cell and eat the ant. Otherwise, the doodlebug moves according to the same rules as the ant. Note that a doodlebug cannot eat other doodlebugs.

• Breed. If a doodlebug survives for eight time steps, then at the end of the time step, it will spawn off a new doodlebug in the same manner as the ant.

• Starve. If a doodlebug has not eaten an ant within the last three time steps, then at the end of the third time step, it will starve and die.

The doodlebug should then be removed from the grid of cells.
During one turn, all the doodlebugs should move before the ants.

Write a program to implement this simulation and draw the world using ASCII characters of "o" for an ant and "X" for a doodlebug.

Create a class named Organism that encapsulates basic data common to both ants and doodlebugs. This class should have an overridden method named move that is defined in the derived classes of Ant and Doodle bug. You may need additional data structures to keep track of which critters have moved.

Initialize the world with 5 doodlebugs and 100 ants. After each time step, prompt the user to press Enter to move to the next time step. You should see a cyclical pattern between the population of predators and prey, although random perturbations may lead to the elimination of one or both species.

Reference no: EM131609147

Questions Cloud

Explain what could make you testify well in court : Every police officer will have to testify in court someday. Police officers can be called to testify on their findings and what they have witnessed
Describe how the product or service will meet consumer need : Describe how the product or service will meet consumer need? Identify at least two technology policies that will apply to the product or service initiative.
Cultural diversity training course : What are the legal implications when asked to starting to a cultural diversity training course and laws that should be considered?
Explain your personal theory : Reflect on your previous assignments and the concepts, theories, and approaches you have learned about throughout the course.
Problem related to the doodlebugs : The goal for this programming project is to create a simple 2D predator-prey simulation. In this simulation, the prey is ants, and the predators are doodlebugs.
Interest in the project and withdraws : Discuss how a project manager should handle a project sponsor who is either incompetent or loses interest in the project and withdraws.
Discuss criminal activities generate illicit proceeds : Organized crime large-scale criminal activities generate illicit proceeds that must be disguised as lawful
Interesting article that contains business : Do an internet search and select an interesting article that contains business, government and society elements.
Calculate the average elapsed time of each process : Calculate the average elapsed time of each process and compare them. Based on your own judgment from two regression models you found, answer the question.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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