board=klass() function board:init() self.cursor=cursor:new(self) self.slots={} self.wells={} -- board slots -- 1,11: normal for i=1,11 do add(self.slots,slot:new()) end -- 12: special add(self.slots,slot:new(1)) assert(#self.slots==12) -- wells: -- 1,2,3,4: wands, cups, swords, pentacles local function add_suit(_self,suit) add(_self.wells,well:new(function(lst,new) assert(lst) -- the ace is always present initially if (new.suit!=suit) return return new.suit==suit and new.rank==lst.rank+1 end)) end for suit in all(deck.suits) do add_suit(self,suit) end -- 5: arcana ascending add(self.wells,well:new(function(lst,new) if (new.suit!='a') return if (not lst) return new.rank==0 return new.rank==lst.rank+1 end)) -- 6: arcana descending add(self.wells,well:new(function(lst,new) if (new.suit!='a') return if (not lst) return new.rank==21 return new.rank==lst.rank-1 end)) self:deal() end function board:deal() local n_conventional_wells=4 local n_slots=10 -- first, pull the aces assert(#deck.aces==n_conventional_wells) assert(#self.wells==n_conventional_wells+2) local available={} for card=1,#deck.cards do available[card]=true end for i=1,n_conventional_wells do local well=self.wells[i] local ace=deck.aces[i] well:add(ace) available[ace]=false end local eligible_bottom_row={} for card=1,#deck.cards do local skip if not available[card] then skip=true else for w in all(self.wells) do if (w:would_accept(card)) skip=true break end end if (not skip) add(eligible_bottom_row,card) end function i_to_slot(i) if (i