ok so 10 hours into my program and this is all I have done...I hate being stupid.
(define-struct slot-machine (w-l w-m w-r))
;; A slot machine is a structure where (make-slot-machine (symbol-a symbol-b symbol-c))
#|
Template for slot-machine
f : Slot-machine ->
(define (f asm)
...(f (slot-machine-w-l))...
...(f (slot-machine-w-c))...
...(f (slot-machine-w-r))...))
|#
;;rando : list -> symbol
;;takes a list and randomly chooses one of the elements from within the list
;;first wheel randomizer
(define w-llist (list . . . . .
. . . . .
. . . . .
. . . .))
;;randomizing function (los -> symbol)
;;returns a random symbol from a list of symbols
(define (w-l list)
(nth list (random (length list))))
(define (nth l n)
(cond
[(zero? n)(first l)]
[(empty? l) empty]
(else (nth (rest l) (- n 1)))))
;;second wheel randomizer (w-l w-clist)
(define w-clist (list . . . . . .
. . . . .
. . . ..
. . . . . .))
;;third wheel randomizer (w-l w-rlist)
(define w-rlist (list . . . . .
. . . . .
. . . . .
. . . . . .))
;;;make the slot machine
;(make-slot-machine (w-l w-llist)(w-l w-clist)(w-l w-rlist))
;;structure -> image
;;imageslot : (make-slot-machine w-l w-c w-r)--> (make-slot-machine image image image)
;
;(place-image
;(on-key-event r (make-slot-machine (w-l w-llist)(w-l w-clist)(w-l w-rlist)))
(define (draw-slots symbol)
(cond
[(symbol=? 'run symbol)(place-image (w-l w-llist) 80 80
(place-image (w-l w-clist) 200 80
(place-image (w-l w-rlist) 320 80 (empty-scene 500 180))))]
[else (display "you suck")]))
(define (win? placed-slots)
(cond
[(symbol=? 'run placed-slots)
(cond
[(equal? (draw-slots 'run)( .* *))"you win"]
[else (display "bite me")])]))
(define writeln
(lambda (args)
(for-each display args)
))
...shoot me please
Current Mood:
drainedCurrent Music: Moby - Inside