Question

In the following code, what would be a good Postcondition to write?

/* Precondition: Karel is on a spot with a tennis ball facing East
* Postcondition: ...
*/
function getOnTop() {
turnLeft();
move();
turnRight();
}
JavaScript


Karel is on a spot with a tennis ball facing north


Karel ends one spot above a tennis ball facing East.


Karel is on the same position but on top of a ball.


Karel is facing East.

Answers

GPT 3.5
Karel is on a spot with a tennis ball facing North
e
are you sure
GPT 3.5
No, I apologize for the confusion.

A more accurate postcondition for the given code would be:
Karel ends one spot above a tennis ball, facing East.