Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun alphabeta (m_stanje dubina alpha beta moj-potez roditelj)
- (if (or (zerop dubina) (pobeda m_stanje (figura_comp moj-potez)))
- (list m_stanje (proc m_stanje) roditelj)
- (if (null moj-potez)
- (min-stanje m_stanje dubina alpha beta moj-potez (if (null roditelj) (car lp) roditelj) (sledbenici m_stanje (figura_comp moj-potez)) (list '99999 '()))
- (max-stanje m_stanje dubina alpha beta moj-potez (if (null roditelj) (car lp) roditelj) (sledbenici m_stanje (figura_comp moj-potez)) (list '-99999 '()))
- )
- )
- )
- (defun max-stanje (m_stanje dubina alpha beta moj-potez roditelj lp v)
- (if (null lp) (list m_stanje (proc m_stanje) roditelj)
- (let* ((v1 (max2 (alphabeta (car lp) (1- dubina) alpha beta (not moj-potez) roditelj) v))
- (a (max (v1 alpha)))
- )
- (if (<= beta a) v1
- (max-stanje m_stanje dubina a beta moj-potez roditelj (cdr lp) v1)
- )
- )
- )
- )
- (defun min-stanje (m_stanje dubina alpha beta moj-potez roditelj lp v)
- (if (null lp) (list m_stanje (proc m_stanje) roditelj)
- (let* ((v1 (min2 (alphabeta (car lp) (1- dubina) alpha beta (not moj-potez) roditelj) v))
- (b (min (v1 beta)))
- )
- (if (<= beta a) v1
- (min-stanje m_stanje dubina alpha b moj-potez roditelj (cdr lp) v1)
- )
- )
- )
- )
- (defun max (p d)
- (if (> (cadr p) d) (cadr p) d))
- (defun min (p d)
- (if (< (cadr p) d) (cadr p) d))
- (defun max2 (p d)
- (if (> (cadr p) (cadr d)) p d))
- (defun min2 (p d)
- (if (< (cadr p) (cadr d)) p d))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement