Backpropagation .*;
Game Character Learning Example
based on article and code by M. Tim Jones
This code example examines a game character's current conditions and selects an action accordingly.
- The four inputs represent:
- health status (2 = healthy, 1 = minor injuries, 0 = major injuries)
- has a knife (1 = yes, 0 = no)
- has a gun (1 = yes, 0 = no)
- number of enemies present
- The four outputs represent the game characters action:
- wander
- attack
- hide
- run
Example Results 1: 100% Correct
- The four inputs (shown in results from left to right) represent:
- health status (2 = healthy, 1 = minor injuries, 0 = major injuries)
- has a knife (1 = yes, 0 = no)
- has a gun (1 = yes, 0 = no)
- number of enemies present
Network is 100.000% correct. 2-1-1-1 Action: Attack 1-1-1-2 Action: Hide 0-0-0-0 Action: Wander 0-1-1-1 Action: Hide 2-0-1-3 Action: Hide 2-1-0-3 Action: Hide 0-1-0-3 Action: Run
Example Results 2: 88.889% Correct
In this run, the last pattern wasn't correctly classified.
0.0 0.0 1.0 2.0 Actual: Hide Expected: Run 0.0 1.0 0.0 2.0 Actual: Hide Expected: Run Network is 88.889% correct. 2-1-1-1 Action: Attack 1-1-1-2 Action: Hide 0-0-0-0 Action: Wander 0-1-1-1 Action: Hide 2-0-1-3 Action: Hide 2-1-0-3 Action: Hide 0-1-0-3 Action: Hide
Example Results 3: 94.444% Correct
Note that even though the network wasn't perfectly trained, it still managed (by chance) to deliver adequate decisions.
0.0 0.0 0.0 1.0 Actual: Run Expected: Hide Network is 94.444% correct. 2-1-1-1 Action: Attack 1-1-1-2 Action: Hide 0-0-0-0 Action: Wander 0-1-1-1 Action: Hide 2-0-1-3 Action: Hide 2-1-0-3 Action: Hide 0-1-0-3 Action: Run
News Links:
Search News Links: