FizzBuzz Path: Possible to get less than 14 statements?

I’ve just tried FizzBuzz Path. My worry is that there isn’t a way to get less than fourteen statements with the code they give you. It’s more like 17 statements. Even with the most efficient code I can think of, it makes exactly fourteen statements. Are we absolutely sure there is a way to get the bonus?

My solution is only 12 statements (if I count correctly) but I don’t get the bonus either.

Just to make sure: the following (pseudo)code counts as 4 “statements”, right?

if something:
    move here
else:
    move there

I’m experiencing a similar issue. If I’m counting correctly, my solution contains only 3 statements and I’m not getting the bonus.

FWIW, my solution consists of:

var step = 0;
while (true) {
    this.moveXY(
        /* bunch of inlined infix and ternary expressions */
    );
}

I made it in 8 statements (if I understand statements correctly that is), but I did not get the bonus, so I think it may be broken? I was just going to write about it and ask if anybody had this problem too ^^"

EDIT: Forgot to mention - I used JS

Aether counts statements differently (according to @nick), so it’s probably an issue with Aether.

(To see what Aether thinks:)

currentView.world.userCodeMap['Hero Placeholder'].plan.metrics

JavaScript AST documentation (which has info for counting statements) can be found here.


So with the FizzBuzz puzzle, if solving this with if/else’s, would be possible with less than 14 statements:

- Program
  - body: WhileStatement (1)
    - body: BlockStatement (2)
      - body: IfStatement (3)
        - consequent: BlockStatement (4)
          - body: ExpressionStatement (5)
        - alternate: IfStatement (6)
          - consequent: BlockStatement (7)
            - body: ExpressionStatement (8)
          - alternate: IfStatement (9)
            - consequent: BlockStatement (10)
              - body: ExpressionStatement (11)
            - alternate: BlockStatement (12)
              - body: ExpressionStatement (13)

If you drop the opening and closing braces with the if/else’s you can eliminate extra BlockStatements (and save 4 statements).

Aye, successful 11 lines in python, and no bonus.

i finished it in 12 statements and it said i didn’t get the extra but then at the end it gave me the reward for less than 14 statements

I worked a bit more on my previous solution, went down to 9 statements (1x loop + 4x if+move), but still no bonus (python).

update: I also tried another working solution with only 3 statements (positions = …; loop; move), but no bonus either.

It’s impossible:

this.moveXY(this.pos.x, this.pos.y+30);
this.moveXY(this.pos.x+10, this.pos.y-10);
this.moveXY(this.pos.x, this.pos.y+40);
this.moveXY(this.pos.x+10, this.pos.y-10);
this.moveXY(this.pos.x, this.pos.y+30);
this.moveXY(this.pos.x-10, this.pos.y+10);
this.moveXY(this.pos.x, this.pos.y+20);
this.moveXY(this.pos.x+10, this.pos.y);
this.moveXY(this.pos.x, this.pos.y+10);

sais succesfull, and is the only code I use. but no less than 14 statements bonus, whilst I have 9. I’ll also try it with pure coordinates.


Edit:
Nope, this doesn’t get the bonus either, but does count as a succes.

this.moveXY(20, 40);
this.moveXY(30, 30);
this.moveXY(30, 70);
this.moveXY(40, 60);
this.moveXY(40, 90);
this.moveXY(30, 100);
this.moveXY(30, 120);
this.moveXY(40, 120);
this.moveXY(40, 130);

Each number counts as a statement. Together with the moveXY commands, your code is more like 27 statements long.

I don’t think the level is meant to be solved with moveXY to specific coordinates at all; rather it’s based off of the Fizz Buzz game/puzzle and you’re supposed to use conditionals with modulo.

As for counting (real) statements (when transformed to JavaScript) there would be 18 ExpressionStatements, each with a CallExpression that takes in two arguments (which are Expressions).

The bonus achievement has been removed, though it would be for the best to solve the puzzle without hardcoding values.

2 Likes

SRSLY?

Don’t worry, I tried 10 different ways of doing it, just to see if I could get the achievement XD

Well the goal remains but for now there’s no reward for actually completing the bonus objective.