initial commit
[applet-bots.git] / applets / kicker.html
blobd4a65fe4936844f7a4a0b6b50e2c3c54b75ce9c2
1 <html>
2 <head>
3 <title>Kicker Bots</title>
4 <link rel="stylesheet" type="text/css" href="../styles.css"/>
5 </head>
6 <body>
7 <div id="content">
8 <h2>Kicker Bots</h2>
9 <h3>Agent Algorithm</h3>
10 <p>
11 A kicker agent chooses a visible ball at random and accelerates
12 towards it. If no ball is visible the agent sets his acceleration
13 to zero.
14 </p>
15 <h4>Pseudocode</h4>
16 <div class="pseudocode">
17 <pre>visibleBalls = {}
18 for all visibleObjects
19 if visibleObject is ball
20 visibleBalls <-- visibleObject
21 if visibleBalls is not empty
22 ball = selectRandom(visibleBalls)
23 accelerate towards ball
24 else
25 set acceleration to zero</pre>
26 </div>
27 <h3>Observed Behavior</h3>
28 <p>
29 Since a kicker agent doesn't remember which ball he's
30 accelerating towards from one moment to the next, if he can see
31 multiple balls (e.g. if Number of Balls or Agent Sight is set high),
32 he will appear to have a pretty short attention span, since
33 the ball he will chose balls randomly each time.
34 </p>
35 <p>
36 The ceasing to accelerate strategy works well when a ball goes
37 out of sight, because chances are the agent was accelerating in the
38 same direction as the ball at last sighting, and an agent without
39 acceleration will bounce around the board just like the ball. To
40 see this, turn down the Agent Sight to around 10 or 15, so that if
41 there's another agent between him and the ball, an agent probably
42 won't be able to see the ball.
43 </p>
44 <p>
45 If there are too many agents or too few balls, the agents will
46 end up trapping the balls in the corners and the game ceases to be
47 interesting.
48 </p>
49 <h3>The Applet</h3>
50 <applet archive="../dist/appletbots.jar"
51 code="appletbots.balls.BallsApplet"
52 alt="Kicker Applet"
53 width="600"
54 height="450">
55 <div>
56 If you see this, you need to either enable java, or install the Sun Java
57 Virtual Machine in your browser. To do so,
58 <a href="http://java.sun.com/getjava/download.html">click here</a>.
59 </div>
60 </applet>
61 <h3>Source Code</h3>
62 <ul>
63 <li>
64 <a href="../src/BallsApplet.java.html">BallsApplet.java</a>
65 </li>
66 <li>
67 <a href="../src/Ball.java.html">Ball.java</a>
68 </li>
69 <li>
70 <a href="../src/Kicker.java.html">Kicker.java</a>
71 </li>
72 </ul>
73 <a href="../" class="return">Back to the Applet Bots Home</a>
74 </div>
75 <div class="official">
76 The official version of this file is at <a href="http://applet-bots.sourceforge.net/applets/kicker.html">applet-bots.sourceforge.net</a>
77 <a href="http://sourceforge.net" class="sf-logo"><img border="0" alt="SourceForge.net Logo" src="http://sflogo.sourceforge.net/sflogo.php?group_id=205988&amp;type=1"/></a>
78 </div>
79 </body>
80 </html>