checkpoint=klass() function checkpoint:init(board,card) self.card=card self.slots={} self.wells={} for s=1,#board.slots do local cnt={} for c in all(board.slots[s].contents) do add(cnt,c) end self.slots[s]=cnt end for w=1,#board.wells do local cnt={} for c in all(board.wells[w].contents) do add(cnt,c) end self.wells[w]=cnt end end function checkpoint:apply(board) for s=1,#board.slots do while #board.slots[s].contents>0 do deli(board.slots[s].contents) end for i in all(self.slots[s]) do add(board.slots[s].contents,i) end end for w=1,#board.wells do while #board.wells[w].contents>0 do deli(board.wells[w].contents) end for i in all(self.wells[w]) do add(board.wells[w].contents,i) end end end