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) (kraj_igre m_stanje))
- (list m_stanje (proc m_stanje) roditelj)
- (if (null moj-potez)
- (min-stanje m_stanje dubina alpha beta moj-potez roditelj (sledbenici m_stanje (figura_comp moj-potez)) '99999)
- (max-stanje m_stanje dubina alpha beta moj-potez roditelj (sledbenici m_stanje (figura_comp moj-potez)) '-99999)
- )
- )
- )
- (defun max-stanje (m_stanje dubina alpha beta moj-potez roditelj lp v)
- (if (null lp) v
- (let* ((v1 (max (alphabeta (car lp) (1- dubina) alpha beta drugoOdMojPotez neZnamStaJeRoditelj) 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) v
- (let* ((v1 (min (alphabeta (car lp) (1- dubina) alpha beta drugoOdMojPotez neZnamStaJeRoditelj) 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 (> p d) p d))
- (defun min (p d)
- (if (< p d) p d))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement