I am doing Edx on the course's Final project encountered a bug, but I don't know how to debug, have who can help me have a look at my code what went wrong, thank you ~
; PROBLEM 2:
;
; In UBC 's version of How to Code, there are, more than 800 students taking
; The course in any given semester, a fancy there are, over 40 would Assistants.
;
; Designing a schedule for them by hand is hard work - luckily we 've learned enough now to write
; A program to do it for us!
;
; Below are some data definitions for a simplified version of a TA schedule. There are some
; The number of slots that must be filled, each represented by a natural number. Each TA is
; Available for some of these slots, and has a maximum number of shifts they can work.
;
; The Design of a search program that consumes a list of TAs and a list of Slots, and produces one
; Valid schedule where each Slot is assigned to a TA, and no TA is working wining their
; Maximum shifts. If no to schedules exist, produce false.
;
; You should supplement the given check - expects and remember to follow the recipe!
;; Slot is Natural
;; Interp. Each TA slot has a number, is the same length, and none overlap
(define - struct ta (the name Max avail))
;; TA is (make - TA String Natural (listof Slot))
;; Interp. The TA 's name, number of slots they can work, and slots they' r e available for
(define SOBA (make - ta "SOBA" 2 (list 1)))
(define UDON (make - ta "UDON" 1 (list 3 4)))
(define RAMEN (make - ta "RAMEN" 1 (2) the list))
(define such - TAs (list SOBA UDON RAMEN))
(define - struct the assignment (ta slot))
;; The Assignment is (make - the Assignment TA Slot)
;; Interp. The TA is assigned to the work the slot
;; The Schedule is (listof the Assignment)
;;=============================FUNCTIONS provides
;; (listof TA) (listof Slot) - & gt; The Schedule or false
;; Produce valid schedule given TAs and Slots; False if impossible
(check - expect (schedule - tas empty empty, empty)
(check - expect (schedule - tas empty (list 1) 2) false)
(check - expect (schedule - tas (list SOBA) empty) empty)
(check - expect (schedule - tas SOBA) (list (list 1)) (list (make - the assignment SOBA 1)))
(check - expect (schedule - tas (list SOBA) (2) the list) false)
(check - expect (schedule - tas SOBA) (list (list 1, 3)) (list (make - the assignment SOBA 3)
(make the assignment SOBA 1)))
(check - expect (schedule - tas such - tas (list 1 2 3 4))
(list
(make the assignment UDON 4)
(make the assignment SOBA 3)
(make the assignment RAMEN 2)
(make the assignment SOBA 1)))
(check - expect (schedule - tas such - tas (list 1, 2, 3, 4, 5)) false)
; (define (schedule - tas tas slots) empty); Stub
(define (schedule - tas tas slots)
(local [(define - struct slot (loc status))
;; Slot is (make - slot number false | ta)
;; The number is the slot location in the list of slot
;; If the status is ta, means the slot is seems care of by that ta
;; If the status is false, means the slot don 't have ta
(define - struct shifts (t, n))
;; Shifts by the ta 's current shifts
;; T is ta, n is the current shifts occupied
(define (initialize - slots slots)
(cond [(empty? Slots) empty]
[the else (cons (make - slot (first slots) false) (initialize - slots (rest slots))))))
(define (initialize - sh tas)
(cond [(empty? Tas) empty]
[the else (cons (make - shifts (first tas), 0) (initialize - sh (rest tas))))))
(define los (initialize - slots slots))
;; Los is listof slot
(define losh (initialize - sh tas))
;; Losh is listof shifts
;; RSF is lisfof slot; The result so far
(define (fn - for - los los losh RSF)
(cond [(empty? Los) RSF]
[(shift - the avail? (filter - out losh (slot - loc (first los) empty))
(if (check the status? First (los))
(fn - for - los (los) for rest losh (cons first los RSF))
(fn - for - los (los) for rest (update - shift losh (slot - loc (first los) empty) (cons (fill in first los losh) RSF)))
[the else
(fn - for - los (los) for rest losh (cons first los RSF))))
(define (check the status? S)
(if (false? (slot - status s))
False
True))
(define (filter - out losh loc RSF)
(cond [(empty? Losh) RSF]
[the else
(if (member loc (ta - the avail (shifts - t (first losh))))
(filter - out (rest losh) loc (cons (RSF) first losh))
Loc (filter - out (rest losh) RSF))))
(define (shift - the avail? Losh)
(cond [(empty? Losh) false]
[the else
(if (& lt; (shifts - n (first losh)) (ta - Max (shifts - t (first losh))))
True
(shift - the avail? (rest losh)))))
(define (update - shift losh loc RSF)
(cond [(empty? Losh) RSF]
[the else
(if (the available? (first losh) loc)
(append (cons (make - shifts (shifts - t (first losh)) (add1 (shifts - n (first losh)))) RSF) (rest losh))
(update - shift (rest losh) loc RSF))))
(define (available? nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull