Simple Applets
Build these games using frames and tools available in NetBeans. Create jar
files for them if you wish.
1. Odds and Evens
- You pick a number between 0 and 5.
- The computer picks a number between 0 and 5.
- If the sum is odd then you win. If it is even, the computer wins.
2. High Roller
- You roll a dice.
- The computer rolls a dice.
- If yours is higher, you win and get a point.
- You might provide the user with a button to reset and begin again.
3. Race to 21
- You are playing against the computer.
- On a turn, you can say (well, type then) one or two numbers.
- Whoever types/prints out 21 wins.
4. Poison
- In the "middle" there is a pile of 12 beans and 1 penny. The penny
is poison.
- You and the computer take turns. On a turn, you can take one or two things
from the pile in the middle.
- Whoever is forced to take the poison on their turn, loses.

5. Odd Bean
- You start with 12 beans. The computer also starts with 12 beans.
- You put any number of your beans in a bag. The computer guesses odd or even.
If they are right, the computer gets the beans in the bag.
- Then the computer puts some of their beans in a bag. If you guess odd or
even correctly, you get the computer's beans that were in their bag.
- The winner is the first one to get all of the beans.
Marking
You will have 4 days to complete this assignment. On the fifth day, at the
start of class, it is due. Anything that is not handed in at this time will
be late and will not be able to achieve higher than a level 4 (IB) or level
3 (Ontario).
IB Level |
Ontario Level |
Criteria |
| 1-2 |
1 |
Odds and Evens works well. |
| 3 |
2 |
Level 2 and High Roller works well. Code is tabbed to make it readible. |
| 4 |
3 |
Level 3 and Race to 21 works well. Comments. Methods that you created
are under 30 lines. |
| 5 |
4 |
Level 4 and Poison works well. |
| 6 |
4+ |
One of: (1) computer uses a strategy to win (AI) in Poison, (2) AI in
Race to 21 or (3) Odd Bean. |
| 7 |
4++ |
Two of those in Level 6. |