1.24 |
Implement the game of Craps (Figure 1-33). You do not need to modify the Die class to do this. |

Craps |
---|

Players: 1 |

Play: Declare how much money you wish to bet, then roll two dice. If the sum is 7 or 11, you win the amount you bet. If the sum is 2, 3, or 12, you lose this amount. Otherwise, the sum is your point. Roll until either you roll your point again (in which case you win) or you roll a 7 (in which case you lose). |

For simplicity, the various side bets involved in the casino version of craps are omitted here. |

1.25 |
Implement the game of Pennywise (Figure 1-34). Your implementation has to handle only two players. (Hint: Create a CoinSet class, which keeps track of the number of pennies, nickels, dimes, and quarters a player has. Another instance of this class can be used to keep track of what's in the pot.) |

Pennywise |
---|

Players: 2-6 |

Object: To be the last player with any coins. |

Setup: Each player starts with four pennies, three nickels, two dimes, and a quarter. The pot is empty at the beginning of the game. |

Play: On your turn, put one of your coins into the pot. You may then take change from the pot, up to one cent less than the value of the coin you played. For example, if you put in a dime, you may take out up to nine cents worth of coins. |

Data Structures and Algorithms in Java

ISBN: 0131469142

EAN: 2147483647

EAN: 2147483647

Year: 2004

Pages: 216

Pages: 216

Authors: Peter Drake

Simiral book on Amazon

Flylib.com © 2008-2017.

If you may any questions please contact us: flylib@qtcs.net

If you may any questions please contact us: flylib@qtcs.net