[plt-scheme] Question result is not true or false: (void)
I am trying to design a sudokku game in dr scheme, but it is proving
difficult.
First what I did was draw out the game with this code:
[code]
(define (d x)
(display x)
)
(display " 1 2 3 4 5 6 7 8
9")
(newline)
(display "
#___________________________________________________________#")
(newline)
(display "A | ")(d "x")(d " x")(d " x")(d " ||")(d " 6")
(d " x")(d " 8")(d " ||") (d " 7")(d " 9")(d "
1") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "B | ")(d "5")(d " 8")(d " 6")(d " ||")
(d " x")
(d " 9")(d " 1")(d " ||") (d " 4")(d " 3")(d "
2") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "C | ")(d "x")(d " 1")(d " 7")(d " ||")(d " x")
(d " x")(d " x")(d " ||") (d " 6")(d " 5")(d "
8") (d " |")
(newline)(display " |")(d "==================||===================||
==================|")
(newline)
(display "D | ")(d "1")(d " x")(d " 9")(d " ||")(d " 3")
(d " x")(d " 6")(d " ||") (d " x")(d " 8")(d "
7") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "E | ")(d "2")(d " 6")(d " 3")(d " ||")(d " 5")
(d " 8")(d " 7")(d " ||") (d " x")(d " 1")(d "
4") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "F | ")(d "8")(d " 7")(d " x")(d " ||")(d " 9")
(d " x")(d " 4")(d " ||") (d " 3")(d " 2")(d "
6") (d " |")
(newline)(display " |")(d "==================||===================||
==================|")
(newline)
(display "G | ")(d "6")(d " 5")(d " x")(d " ||")(d " 8")
(d " x")(d " x")(d " ||") (d " 1")(d " x")(d "
3") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "H | ")(d "7")(d " x")(d " 8")(d " ||")(d " 1")
(d " x")(d " x")(d " ||") (d " x")(d " 6")(d "
5") (d " |")
(newline)(display " |")(d " ||
|| |")
(newline)
(display "I | ")(d "4")(d " 3")(d " x")(d " ||")(d " x")
(d " 6")(d " x")(d " ||") (d " x")(d " x")(d "
x") (d " |")
(newline)
(display "
#-----------------------------------------------------------#")
(newline)
[/code]
I had an idea on how to make the game actually work.It would require
every line to have its own condition like so:
[code]
(define (draw-game x)
(cond
[(= x 1) (and (display " 1 2 3 4 5
6 7 8 9") (doit (+ x 1)))]
[(= x 2)(and (newline) (doit (+ x 1)))]
[(= x 3) (and (display "
#___________________________________________________________#")(doit
(+ x 1)))]
)
)
[/code]
Why can't I use the conditional like I did above?
I get this error [code] and: question result is not true or false:
(void) [/code]
Is there another way I could get the game working?