Problem_Set_06_Solutions_Code

# Problem_Set_06_Solutions_Code - Discrete Math PS-6 Exercise...

This preview shows pages 1–3. Sign up to view the full content.

;;; Discrete Math PS-6 ;;; Exercise 2 ;; attacker's possible list of throws (frequency, aj, ai) (define a-list (list '(1 1 1) '(3 2 1) '(3 3 1) '(3 4 1) '(3 5 1) '(3 6 1) '(4 2 2) '(9 3 2) '(9 4 2) '(9 5 2) '(9 6 2) '(7 3 3) '(15 4 3) '(15 5 3) '(15 6 3) '(10 4 4) '(21 5 4) '(21 6 4) '(13 5 5) '(27 6 5) '(16 6 6))) ;; defender's possible list of throws using 2 dice (frequency dj di) (define d2-list (list '(1 1 1) '(2 2 1) '(2 3 1) '(2 4 1) '(2 5 1) '(2 6 1) '(1 2 2) '(2 3 2) '(2 4 2) '(2 5 2) '(2 6 2) '(1 3 3) '(2 4 3) '(2 5 3) '(2 6 3) '(1 4 4) '(2 5 4) '(2 6 4) '(1 5 5) '(2 6 5) '(1 6 6))) ;; defender's possible list of throws using 1 die (define d1-list '(1 2 3 4 5 6)) ;; game1 when the defender throws 1 die all the time (define (game1) (let ((org-d1-list d1-list)) (define (helper total a-score d-score a-list d1-list)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
(cond ((null? d1-list) (helper total a-score d-score (cdr a-list) org-d1-list)) ((null? a-list) (newline) (display (list 'd-score d-score (/ d-score total))) (newline) (display (list 'a-score a-score (/ a-score total))) (newline)
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 10/01/2011.

### Page1 / 4

Problem_Set_06_Solutions_Code - Discrete Math PS-6 Exercise...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online