public bool canPut(int x, int y, Obake obake) { if (board[x, y].Count == 0 || board[x, y].Peek().size < obake.size) { return(true); } return(false); }
public void move(int x, int y, Obake obake) { if (obake.nowXY[0] != -1 && obake.nowXY[1] != -1) { board[obake.nowXY[0], obake.nowXY[1]].Pop(); } board[x, y].Push(obake); obake.nowXY[0] = x; obake.nowXY[1] = y; nowTrunOwner = 1 - nowTrunOwner; }
// Stackの一番上のおばけだけ移動可能 public bool canMove(Obake obake) { if (obake.owner != nowTrunOwner) { return(false); } if (obake.nowXY[0] != -1 && obake.nowXY[1] != -1) { if (board[obake.nowXY[0], obake.nowXY[1]].Peek() != obake) { return(false); } } return(true); }