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