资 源 简 介
Abstraction as a Means of Extensible Design
Below you will read about some specific two-person games you are to analyze. However, we will also show you how these games fit into a more general analysis pattern. If you know this, you can design your program to this more abstract model, thereby allowing you to plug in new games with less effort.
There are four games for you to develop. We describe, the common characteristics of these games in the background section.
Here are some simple games that all have common characteristics. If you are not familiar with any of them, try playing the game a few times. The strategy discussions will then be clearer.
Take Away
In front of both players is a pile of pennies. When it is a player"s turn to play, the player must take 1, 2, or 3 pennies from the pile. At least one coin must be taken. The loser is the player who takes the last coin. A simple strategy is to try to leave your opponent 1, 5, 9, 13... coins