Packages and Access Levels

Table of contents:

Projects

3.13

Implement the game of Bogart (Figure 3-17). Your implementation has to handle only two players. (Hint: Create a class FourSidedDie which extends Die. Alternately, if you have done Exercise 3.12, you can use the PolyhedralDie class.)

Figure 3-17. Like Pennywise, the game of Bogart is an invention of James Ernest. Used with permission of the designer.

Bogart

Players: 2-6

Object: To be the first to either accumulate 30 chips or roll all five dice at once without rolling a 1.

Setup: The pot is initially empty and all players start with no chips. New chips will be added to the pot from an inexhaustible bank.

Play: When your turn begins, add one chip from the bank to the pot. Roll a four-sided die. If you get a 1, you have aced out and your turn ends. Otherwise, you may either take the pot or keep going. If you keep going, add two chips to the pot and roll two dice. If you roll a 1 on either die, you have aced out. Otherwise, you may keep going, this time adding three chips and rolling three dice. Continue until you either ace out, decide to take the pot, or successfully roll all five dice without acing out.


Part I: Object-Oriented Programming

Encapsulation

Polymorphism

Inheritance

Part II: Linear Structures

Stacks and Queues

Array-Based Structures

Linked Structures

Part III: Algorithms

Analysis of Algorithms

Searching and Sorting

Recursion

Part IV: Trees and Sets

Trees

Sets

Part V: Advanced Topics

Advanced Linear Structures

Strings

Advanced Trees

Graphs

Memory Management

Out to the Disk

Part VI: Appendices

A. Review of Java

B. Unified Modeling Language

C. Summation Formulae

D. Further Reading

Index



Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
ISBN: 0131469142
EAN: 2147483647
Year: 2004
Pages: 216
Authors: Peter Drake

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net