Delete coursepages/spd/ta-solver-starter.rkt

This commit is contained in:
Pulkit Krishna 2024-03-26 10:28:57 +05:30 committed by GitHub
parent 98cb2b8016
commit 9500b89b03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 87 deletions

View File

@ -1,87 +0,0 @@
;; ta-solver-starter.rkt
; PROBLEM 1:
;
; Consider a social network similar to Twitter called Chirper. Each user has a name, a note about
; whether or not they are a verified user, and follows some number of people.
;
; Design a data definition for Chirper, including a template that is tail recursive and avoids
; cycles.
;
; Then design a function called most-followers which determines which user in a Chirper Network is
; followed by the most people.
;
; PROBLEM 2:
;
; In UBC's version of How to Code, there are often more than 800 students taking
; the course in any given semester, meaning there are often over 40 Teaching 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
; 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.
;
; Design 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 more than their
; maximum shifts. If no such 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 (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're available for
(define SOBA (make-ta "Soba" 2 (list 1 3)))
(define UDON (make-ta "Udon" 1 (list 3 4)))
(define RAMEN (make-ta "Ramen" 1 (list 2)))
(define NOODLE-TAs (list SOBA UDON RAMEN))
(define-struct assignment (ta slot))
;; Assignment is (make-assignment TA Slot)
;; interp. the TA is assigned to work the slot
;; Schedule is (listof Assignment)
;; ============================= FUNCTIONS
;; (listof TA) (listof Slot) -> 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 (list SOBA) (list 1)) (list (make-assignment SOBA 1)))
(check-expect (schedule-tas (list SOBA) (list 2)) false)
(check-expect (schedule-tas (list SOBA) (list 1 3)) (list (make-assignment SOBA 3)
(make-assignment SOBA 1)))
(check-expect (schedule-tas NOODLE-TAs (list 1 2 3 4))
(list
(make-assignment UDON 4)
(make-assignment SOBA 3)
(make-assignment RAMEN 2)
(make-assignment SOBA 1)))
(check-expect (schedule-tas NOODLE-TAs (list 1 2 3 4 5)) false)
(define (schedule-tas tas slots) empty) ;stub