Difference between revisions of "Module/Movement/Walls"
Jump to navigation
Jump to search
(Module movement Walls) |
(use <syntaxhighlight>) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | < | + | <syntaxhighlight> |
package jab.movement; | package jab.movement; | ||
| Line 22: | Line 22: | ||
} | } | ||
} | } | ||
| − | </ | + | </syntaxhighlight> |
| + | |||
| + | [[Category:Code Snippets]] | ||
Latest revision as of 07:20, 1 July 2010
package jab.movement;
import jab.Module;
import jab.Movement;
/**
* Credits
* Walls - a sample robot by Mathew Nelson, and maintained by Flemming N. Larsen
**/
public class Walls extends Movement{
public Walls(Module bot) {
super(bot);
}
public void move() {
if (bot.getHeading() % 90 != 0) bot.setTurnLeft(bot.getHeading() % 90);
bot.setAhead(Double.POSITIVE_INFINITY);
if (bot.getVelocity()==0)
bot.setTurnRight(90);
}
}