#What does this error mean

1 messages ยท Page 1 of 1 (latest)

carmine loom
wicked mothBOT
#

<@&987246399047479336> please have a look, thanks.

fierce thicket
#

For-loops in java must always have three parts within the parentheses, delimited with semicolons. You can leave any of the parts blank, but you need to include the semicolon separators. You for-loop only has one semicolon between the parenthses

carmine loom
sour pebble
#
for (int i = 0; i < 14;) {

}
#

would do the same as

#
for (int i = 0; i < 14; i=i) {

}
#

since well, i=i doesn't do anything

carmine loom
#

sadge it doesn't work

#

๐Ÿ™

sour pebble
#

well thats a logic problem, no?

carmine loom
#

probably but I don't get it

sour pebble
#

the problem here is that you ask

#

"is the front clear"

#

if yes, go forward

#

if no...?

#

just does nothing

#

then

#

while the front is blocked - turn left, move forward, turn right move forward, ...

#

but thats not really general directions

carmine loom
sour pebble
#

yeah no i get that

#

i'm saying that those directions don't work when you get to the end

#

try this

#
if (frontIsClear()) {
    move();
    i++;
    continue;
}
if (frontIsBlocked()) {
    jumpHurdle();
    i++;
    continue;
}
#

what I think is happening (and to be clear i'm not reading too closely)

#

is that you know you need to go 14 spaces total

#

and you either go forwards or "hop", which is a bunch of small steps

#

but because you say "while front is clear"

#

and "while front is blocked"

#

you are making more than 14 moves

#

and so are just reaching the end and trying to hop over the last wall

carmine loom
sour pebble
carmine loom
#

I feel like I'm doing dat tho since I place one "jumpHurdle" and one block

sour pebble
#
public void run() {
    for (int i = 0; i < 14; i++) {
        if (frontIsClear()) {
            move();
        }
        else {
            jumpHurdle();
        }
    }
}
#

try this^

sour pebble
carmine loom
carmine loom
sour pebble
#

if you have 14 spaces to go and you start in one of those spaces

#

well thats only 13 to go

carmine loom
#

ok, I get it thx

#

.close

wicked mothBOT
# carmine loom .close

Looks like you attempted to use a command? Please note that we only use slash-commands on this server ๐Ÿ™‚

Try starting your message with a forward-slash / and Discord should open a popup showing you all available commands.
A command might then look like /foo ๐Ÿ‘