Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w04 exercise 7c: incorrect solution in answer key #667

Closed
snctfd opened this issue Sep 21, 2022 · 0 comments
Closed

w04 exercise 7c: incorrect solution in answer key #667

snctfd opened this issue Sep 21, 2022 · 0 comments

Comments

@snctfd
Copy link
Contributor

snctfd commented Sep 21, 2022

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?

bjornregnell added a commit that referenced this issue Sep 22, 2022
fix #667 'w04 exercise 7c: incorrect solution in answer key'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant