;;; Code for the Spider Solitaire domain ;;; The underlying structure of a spider game is a deterministic ;;; partially observable problem. ;;; Each problem instance is defined by the initial shuffling of the cards. ;;; Given the actual card state, the outcome of any action (including ;;; dealing a new row) is determined. (defstruct (spider-problem (:include poproblem) (:constructor create-spider-problem)) "Class of spider solitaire problems." num-packs ; number of packs of cards (52 each) num-suits ; number of suits - 1, 2, or 4 num-stacks ; number of stacks num-hidden-rows ; number of complete rows of hidden cards (may need an extra partial row) ) (defun make-spider-problem (&key (num-packs 2) (num-suits 4) (num-stacks 10) (num-hidden-rows 4)) "Returns a randomly generated spider solitaire instance." (create-spider-problem :num-packs num-packs :num-suits num-suits :num-stacks num-stacks :num-hidden-rows num-hidden-rows :initial-state (deal (shuffle (make-spider-cards num-packs num-suits)) num-packs num-stacks num-hidden-rows))) (defmethod print-object ((problem spider-problem) stream) "Print out the parameters of a particular spider solitaire instance." (format stream "