?

AP® Computer Science Principles

Free Version

Upgrade subject to access all content

Easy

Wa-Tor

APCSP-NXS51R

Alex has written code implementing a prey-predator relationship. He has coded a class for the sharks (predator), the fish (prey), and a graphical view to show these creatures on a grid moving about in an ocean of blue. Though the code appears to work correctly, Alex finds that the implementation is terribly slow.

If he has more than 25 or so creatures in his ocean, the computer slows to a crawl and it takes hours to run his simulation. He would like to have the simulation running with thousands of creatures in the ocean.

What you recommend to Alex to improve the implementation of his simulation?

Select TWO answers.

A

Consider implementing his code in a different language — some languages are better suited to running simulations with a large number of objects than others.

B

Consider choosing a different problem — the ocean is too big a place to create a simulation on a modern computer.

C

Consider his graphical implementation — perhaps there is a way to speed up the graphs he has paired with simulation.

D

Consider adding a plankton class for the fish to consume — perhaps adding a layer of complexity will give insight into the fish-shark relationship.