체계를 사용하여 게임 이론 알고리즘을 구현하려고합니다. 나는 두 tat에 대한 tit라는 코드 조각을 썼다."cond"in scheme을 사용하는 방법?
(define (tit-for-two-tat my-history other-history)
(cond ((empty-history? my-history) 'c)
((= 'c (most-recent-play other-history)) 'c)
((= 'c (second-most-recent-play other-history)) 'c)
(else 'd)))
나는이처럼 쓸 시도 :
(define (tit-for-two-tat my-history other-history)
(cond ((empty-history? my-history) 'c)
((= 'c (or (most-recent-play other-history) (second-most-recent-play other-history))) 'c)
(else 'd)))
게임의 경우는 '죄수의 딜레마'는 여기에 코드입니다. c는 좌표 d는 결함을 의미합니다. 이 코드를 실행하려고하면 그것은 코드의 두 유형에서 다음과 같은 오류를 제공합니다 :
expects type <number> as 1st argument, given: 'c; other arguments were: 'c
내가 기능 "플레이 루프"에 매개 변수로이 기능을 제공하여 실행하고 있습니다. 플레이 루프가 나에게 주어집니다.
무슨 문제 일 수 있습니까? 도와 줘서 고마워.
당신을 감사합니다 :) – user2870