http://hk.geocities.com/tpfung2006/Player.java
http://hk.geocities.com/tpfung2006/Player.java
http://hk.geocities.com/tpfung2006/Player.class
http://hk.geocities.com/tpfung2006/PlayerTest.java
http://hk.geocities.com/tpfung2006/PlayerTest.class
This game are two players fighting, each of their power are 100. One player attacks the other. The winner, determined by random, receives the difference between the power of the players before the attack. The loser, on the other hand, loses the same amount. For example, consider that Pong and Lam have 99 and 101 points of power respectively before the attack. If Lam wins the attack, then Pong’s power would become 97, and Lam’s power would become 103:
Pong: 99 -> 97
Lam: 101-> 103
If the difference is zero before the attack, then use 1 as the difference. For example, consider that Pong and Lam also have 100 points of power respectively before the attack. If Lam wins the attack, then Pong’s power would become 99, and Lam’s power would become 101:
Pong: 100 -> 99
Lam: 100-> 101
The process is repeated until one player is dead, which occurs when the power becomes negative. End the game and display the power of all the users.