Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun nextState (st act)
- "generate the nextState after state st and action act from prolem"
- (let ((new-state (make-state :action act :track (state-track st))))
- (setf (state-vel new-state)
- (make-vel (+ (vel-l (state-vel st)) (acce-l act))
- (+ (vel-c (state-vel st)) (acce-c act))))
- (setf (state-pos new-state)
- (make-pos (+ (pos-l (state-pos st)) (vel-l (state-vel new-state)))
- (+ (pos-c (state-pos st)) (vel-c (state-vel new-state)))))
- (setf (state-cost new-state)
- (cond ((isGoalp new-state) -100)
- ((isObstaclep (state-pos new-state) (state-track new-state)) 20)
- (T 1)))
- (when (= (state-cost new-state) 20)
- (setf (state-vel new-state) (make-vel 0 0))
- (setf (state-pos new-state) (make-pos (pos-l (state-pos st))
- (pos-c (state-pos st)))))
- (values new-state)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement