java - Becker Robots: Getting them to move -
java - Becker Robots: Getting them to move -
so have utilize becker.robots bundle move forwards , pick amount of flashers , turn around , place them. however, not sure how invoke robot.move() method. everytime seek create move forwards compiler error saying :
error: method move in class becker.robots.robot cannot applied given types; required: no arguments found: int reason: actual , formal argument lists differ in length
could please help me :)
moving robot in karel/becker can move single step @ time. design, of course.
from documentation.
if wish move 6 spaces forward, need loop:
for(int = 0; < 6; i++) { robot.move(); } or phone call robot.move() 6 times:
robot.move(); robot.move(); robot.move(); robot.move(); robot.move(); robot.move(); alternatively, can create method move multiple times.
void custommove(int move) { for(int = 0; < move; i++) { robot.move(); } } then phone call of custommove(6); move karel forwards 6 times.
obviously, avoid breaking karel, should check if it's clear before moving, conceptual design movement.
java karel
Comments
Post a Comment