// return if the cell has stopped being encircled by removing the given wall public bool remWall(uint wall) { // if the given wall is not empty if ((wall &= all) == none) { return(false); } // if the wall does not exist // ... // if more than one wall will be removed // ... // remove the given wall walls &= ~wall; wallcnt = CalculateWallCnt(); // check if the cell has stopped being circled if (player_id != Player.invalid_id) { player_id = Player.invalid_id; amblem = null; return(true); } return(false); }
// return if the cell has become encircled by adding the given wall public bool addWall(Player player, uint wall) { // if the given wall is not empty if ((wall &= all) == none) { return(false); } // if the wall already exists // ... // if more than one wall will be added // ... // add the given wall walls |= wall; wallcnt = CalculateWallCnt(); // incremental check if new paths were created or broken because of adding wall // if( wall == lef || wall == rig ) // ... // check if the cell has become encircled if (walls == all && player_id == Player.invalid_id) { player_id = player.id; amblem = player.GetAmblem(); return(true); } return(false); }
// restore the original cell walls (useful if the cell is touching the table edges) public void reset() { player_id = Player.invalid_id; amblem = null; walls = def_walls; pathnum = 0; wallcnt = CalculateWallCnt(); for (int l = 0; l < wcnt; l++) { lbl[l] = ""; lbltemp[l] = ""; } }