How do we fix these errors?


207
views
0
12 weeks ago by

https://code.world/#PKt1-1CMdgMTQPSMno7DD0g   <--------------- Link to program.

 

We don't know how to answer them.  We wonder if we are missing some parts, example: motion, etc.

Please help!!!!!!

add commentfollow this post modified 12 weeks ago by Chris Smith   • written 12 weeks ago by Alyssa Ann Dilan  

1 Answer


0
12 weeks ago by

There are several things going on here.

The quickest problems to fix are in drawing the picture.  Your idea is fine, but you have a few careless errors here:

  1. gray is a function, and needs a parameter saying which shade.
  2.  It looks like you have two flags.  Shouldn't there be just one?
  3. On both lines 31 and 32, your translated function is on the inside, so its x and y parameters need to come before the color that goes with the colored function.

There is a more fundamental problem in your step function.  Your step function needs a World as its parameter.  Instead, you've written it to receive just four numbers.  You'll need to break down your step into separate functions for each of the three parts of the World (the marble, ball, and flag).

add comment modified 12 weeks ago by Chris Smith   • written 12 weeks ago by Chris Smith  

one of the flags is for the pole (FlagF)

written 12 weeks ago by Alyssa Ann Dilan  

You don't need a fourth piece of state for that. The flag pole doesn't change, so it doesn't have any state. You can just do this instead:

flag(f)   = colored(translated(solidRectangle(1,5),gray),7,-7) &
            colored(translated(solidRectangle(1,4),green),6,-7)
written 12 weeks ago by Chris Smith  
Please log in to add an answer/comment or follow this question.

Share this question


Similar posts:
Search »