;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname a4interface) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; CS115 Winter 2019
;; Assignment 4
;; Question 1
;; q1a
(define-struct xy-path (x1 y1 x2 y2 x3 y3 x4 y4))
;; q1b
(define (xy-path-length path) ...)
;; q1c
(define-struct posn-path (p1 p2 p3 p4))
;; q1d
(define (posn-path-length path) ...)
;; q1e
(define (shortest-path2 path0 path1) ...)
(define (shortest-path4 path0 path1 path2 path3) ...)
;; q1f
(define (shortest-path p0 p1 p2 p3) ...)
;; Question 2
;; q2
(define-struct weapon (damage-per-strike health))
;; A Weapon is a (make-weapon Nat Nat)
;; Requires:
;; damage-per-strike > 0
(define-struct combatant (sword health))
;; A Combatant is a (make-combatant Weapon Nat)
(define-struct battle-outcome (attacker opponent))
;; A Battle-Outcome is a (make-battle-outcome
;; Combatant Combatant)
;; q2a
(define (total-damage w) ...)
(define (engage-opponent? w c) ...)
;; q2b
(define (strike-opponent attacker opponent) ...)