// Cycle the current and next piece and check if the board is topped. void cyclepcs(bool holdset) { brd.pc = (holdset ? brd.holdpc : newpc()); brd.holdpc = newpc(); brd.pc.pos.y = pcheight(brd.pc); brd.pc.pos.x = brd.width/2; brd.holdpc.pos.y = 0; brd.holdpc.pos.x = 2; if (brd.grid) brd.topped = overlap(brd.pc); }
PushComputation swap_pc(const PushComputation &pc, Transition action) { PushComputation newpc(pc); if(action == LA_SWAP) { newpc.jls = (newpc.jls == -1 ? newpc.z : std::min(newpc.z, newpc.jls)); } else if(action == RA_SWAP) { newpc.zrs = newpc.j; } std::swap(newpc.y, newpc.z); std::swap(newpc.yls, newpc.zls); std::swap(newpc.yrs, newpc.zrs); return newpc; }