-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Description
The exercise description for w04 exercise 7c asks the student to draw a square with its upper left corner at (100, 100). It gives the following code as a start:
1 > curl -sLO https://fileadmin.cs.lth.se/introprog.jar
2 > scala -cp introprog.jar
3 scala> val w = new introprog.PixelWindow(400,300,"HEJ")
4 scala> w.line(100, 100, 200, 100)
5 scala> w.line(200, 100, 200, 200)
6 scala> // fortsätt så att en hel kvadrat ritas
This seems correct, however the answer key ("facit") lists the following solution:
1 > scala -cp introprog_3-1.2.0.jar -repl
2 scala> val w = new introprog.PixelWindow(400,300,"HEJ")
3 scala> w.moveTo(100, 100)
4 scala> w.lineTo(200, 100)
5 scala> w.lineTo(200, 200)
6 scala> w.lineTo(100, 200)
7 scala> w.lineTo(100, 100)
Which uses functions that don't actually exist in the PixelWindow API, leading to errors and thus great confusion and sadness. The functions used seem to possibly be assuming a "turtle" style drawing, like in Kojo?
Metadata
Metadata
Assignees
Labels
No labels