Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Bug.java MrG 2011.1013
- public class Bug
- {
- private int pos;
- private int dir;
- public Bug(int pos)
- {
- this.pos = pos;
- this.dir = 1;
- }
- public int getPos()
- {
- return pos;
- }
- public void move()
- {
- pos = pos + dir;
- }
- public void turn()
- {
- dir = dir*-1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement