Pond tutor mistake

38 views
Skip to first unread message

Sergi Llobet

unread,
Jul 19, 2023, 11:42:24 AM7/19/23
to Blockly Games
Hello,

when solving pond tutor nr 9, you need to approach to target till arrive 50. The solution I think it is wrong, once you should swim if X>50 (while you are further than 50) and not X<50. But the player swims if you write  X<50. 

while (true) { if (getX() < 50) { swim(0); } else { stop(); cannon(0, 40); } }

May be I misunderstand something...

Thanks,

Sergi Llobet




Neil Fraser

unread,
Jul 19, 2023, 12:05:21 PM7/19/23
to blockl...@googlegroups.com
Could you tell me more about the 'solution'?  Is that a third-party lesson plan or book or something?  Where does "X>50" come from?

The code you wrote is exactly correct.  You got it.

--
You received this message because you are subscribed to the Google Groups "Blockly Games" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly-game...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly-games/a3cf86b5-8662-4f4e-af9e-e26f0e89498bn%40googlegroups.com.


--
Neil Fraser, Switzerland
https://neil.fraser.name

Sergi Llobet

unread,
Jul 20, 2023, 11:00:05 AM7/20/23
to blockl...@googlegroups.com
Hi Neil

The fact is that the right code should be while (true) { if (getX() > 50) { swim(0); } else { stop(); cannon(0, 40); } }, once the ship should swim if the distance is bigger than 50. I understand getX() is the distance between the two ships, so that, while the distance is bigger (>) than 50, ship should swim. The solution says to swim if the distance is lower than 50 (>50) that is what I do not understand.

Best regards

Sergi Llobet


Missatge de Neil Fraser <ro...@neil.fraser.name> del dia dc., 19 de jul. 2023 a les 18:05:

Sergi Llobet

unread,
Jul 21, 2023, 5:20:33 AM7/21/23
to Blockly Games
Hi again

My mistake. get (X) is position, not distance. 

Best regards,

Sergi

El dia dimecres, 19 de juliol de 2023 a les 17:42:24 UTC+2, Sergi Llobet va escriure:
Reply all
Reply to author
Forward
0 new messages