Fundamentals of Computer Science II (CSC-152 97F)
Outline of Class 8: Game Simulation
- Today, instead of going over new Java concepts, we will work
together and separately to design a simple Java game simulation.
- Suppose you are asked to simulate the game of racquetball (not
visually, just "mathematically").
- What classes and objects might we include?
- Given a decision as to what classes to include, what methods should
- How should we test our classes?
- How might we extend this into a larger simluation?
- What else do we need to know to get our simulation working?
- Don't read this section until after the discussion!
- I would suggest including the following classes
- Player: keeps track of "characteristics" of players; plays for
- ScoreBoard: keeps track of the score and who is serving.
May determine end of game.
- Game or Referee: Ties together players and the scoreboard.
- For more complex simulations, such as tournaments, or statistical
simulations of a large number of games, one might also include:
- RecordTable: keeps a history of all the games.
- Tournament: organizes players; describes who plays next.
- For truly complex simulations, we might even add a
class, so that we use information on the ball to affect hitting and
- Players might have
- ScoreBoards would probably have
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Wed Nov 5 12:36:29 1997.
This page generated on Wed Nov 5 12:38:47 1997 by SiteWeaver.
Contact our webmaster at firstname.lastname@example.org