-
Notifications
You must be signed in to change notification settings - Fork 0
/
std.lsp
13 lines (13 loc) · 973 Bytes
/
std.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
(define if `(if1 (define (++ if $p1) $p2) (define (++ if (+ $p1 1)) $p3))')
(define for `(if 1 `(_for (p6) $p5 $p6 $p4)' `(id $p4)' $p1 $p2 $p3)')
(define _for `(if (p2) `(_for (p6) $p5 $p6 $p4)' `(id $p7)' $p1 $p2 $p3 $p4)')
#Guessing game
(define game `(game_ (define i 1) 0 0 0 0 0 0 0 (rand 100))')
(define game_ `(for 1 `(! (turn $p9 (define i (+ $i 1))))' `(++ (id `Correct with try number: ') (+ $i 1))')')
(define turn `(turn_ 0 0 0 0 0 0 0 0 $p1 (input (id `What is your guess?')))')
(define turn_ `(if (= $p10 $p9) `(id 1)' `(id (print (result $p9 $p10)) 0)')')
(define close `(if (&& (< (- $p1 $p2) 5) (< (- $p2 $p1) 5)) `(id `Oooh you are close!')' `(id ` ')')')
(define far `(if (|| (> (- $p1 $p2) 20) (> (- $p2 $p1) 20)) `(id `Not even close!')' `(id ` ')')')
(define distance `(++ (close $p1 $p2) (far $p1 $p2))')
(define h_or_low `(if (< (- $p2 $p1) 0) `(id `Too Low. ')' `(id `Too High. ')')')
(define result `(++ (h_or_low $p1 $p2) (distance $p1 $p2))')