Exercise 2.5
Make the crab turn left
Yeah I did it like I wrote on my last post! :) I wrote a negative number, and got it turned left.
Exercise 2.6
Try different values for N by using the move() and turn (N)
I changed the move number to -5 from -45. After I changed it, the crab started to slowly move left.
Exercise 2.7
Removing the semicolon after move() (It is a exercise to learn about errors)
It makes a yellow highlighting thing. It also makes the yellow highlighting every time you do a spelling error, semicolon error, and random changes on the code.
Exercise 2.8
Marking various changes to cause different error messages.
So when you make a error, usually, at the bottom of the screen, it tells you what is wrong.
Since I didn't but a semicolon, it shows at the bottom what you should do. Also when I misspell,
It shows "maybe you meant" and stuff.
Exercise 2.9
Switch to documentation view, find how many methods does the class have
Since the crab is at the world edge, it shows 'true'
So since the crab just goes around the edge, let's make the crab to turn around when it goes the the world edge.
To do that, in the code, we put
if ( atWorldEdge() )
{
turn (17) ;
}
move ();
which simply meaning that we are ordering the crab to move when it goes to the world edge.
But the crab isn't that accurate when it goes on the edge of the world. So I think I need to work on that.
Exercise 2.12
Try to make the crab turn at the world edge
Yes. I did it. By the code above
Exercise 2.13
Experiment with different values for the parameter to the turn method
I think 100 is fine.
Exercise 2.14
Place the move() statement inside the if-statement, rather than after it.
Find out what is the effect and explain the behavior you observe.
From today's work, I learned a lot of things.
I think I am going to love Green foot. So far, so good.
And I am having fun playing Green foot.
Make the crab turn left
Yeah I did it like I wrote on my last post! :) I wrote a negative number, and got it turned left.
Exercise 2.6
Try different values for N by using the move() and turn (N)
I changed the move number to -5 from -45. After I changed it, the crab started to slowly move left.
Exercise 2.7
Removing the semicolon after move() (It is a exercise to learn about errors)
It makes a yellow highlighting thing. It also makes the yellow highlighting every time you do a spelling error, semicolon error, and random changes on the code.
Exercise 2.8
Marking various changes to cause different error messages.
So when you make a error, usually, at the bottom of the screen, it tells you what is wrong.
Since I didn't but a semicolon, it shows at the bottom what you should do. Also when I misspell,
It shows "maybe you meant" and stuff.
Exercise 2.9
Switch to documentation view, find how many methods does the class have
To change the documentation view, you have the press the left corner of the screen.
and from my screen, it looks like my crab only has one method. To check what method you have, looking under method summary, it shows you a lot of things.
* In the method page, the three important methods for me right now are
boolbean atWorldEdge()
test if we are close to one of the edges of the world
void move()
move forward in the current direction
void turn (int angle)
Turn "angle" degrees toward the right (clockwise)
boolean
is when it answers with true or false
Exercise 2.10
Clicking boolean at WorldEdge when the crab isn't on the edge of the world
You might not be able to see, but it says 'false'. Since it is not at the world edge
Exercise 2.11
Clicking boolean when the crab is on the edge
Since the crab is at the world edge, it shows 'true'
So since the crab just goes around the edge, let's make the crab to turn around when it goes the the world edge.
To do that, in the code, we put
if ( atWorldEdge() )
{
turn (17) ;
}
move ();
which simply meaning that we are ordering the crab to move when it goes to the world edge.
But the crab isn't that accurate when it goes on the edge of the world. So I think I need to work on that.
Exercise 2.12
Try to make the crab turn at the world edge
Yes. I did it. By the code above
Exercise 2.13
Experiment with different values for the parameter to the turn method
I think 100 is fine.
Exercise 2.14
Place the move() statement inside the if-statement, rather than after it.
Find out what is the effect and explain the behavior you observe.
From today's work, I learned a lot of things.
I think I am going to love Green foot. So far, so good.
And I am having fun playing Green foot.
Sorry about the space between pictures and text. I don't know why it's doing that. :(
ReplyDelete