public GoPoint GetPoint(GoCoord coord) { if (!coord.IsVaild(SIZE)) { return(null); } return(layout_[coord.GetIndex(SIZE)]); }
// public bool SetDian(GoCoord coord, GoDianType type) // { // // else if (dian.Type == type) // { // // no change // return true; // } // else if (type == GoDianType.EMPTY) // { // // Remove Zi // RemoveChess(dian); // return true; // } // else if (dian.Type != GoDianType.EMPTY) // { // // if (!allowChangeZi_) // // { // // //Error need refresh // // GoException.Throw("Cannot change chess, should remove it firstly"); // // } // RemoveChess(dian); // } // dian.Type = type; // dian.Block = new GoBlock(SIZE, dian); // // if (autoTake_) // // { // if (dian.Qi == 0 && !CheckTiZi(dian)) // { // RemoveChess(dian); // return false; // } // else // { // CheckTiZi(dian); // } // /* }*/ // // if (DianChanged != null) // { // DianChanged(); // } // // return true; // } public bool SetupPoint(GoCoord coord, GoPointType type) { GoPoint point = GetPoint(coord); if (point != null && point.Type != type) { OnRemoveChess(point); OnAddChess(coord, type); OnChessChanged(); } return(true); }
private GoPoint OnAddChess(GoCoord coord, GoPointType type) { GoPoint point = GetPoint(coord); if (point == null) { GoException.Throw("The Coord is out of bounds"); } else if (point.Type == type) { // no change return(point); } if (point.Type != GoPointType.EMPTY) { GoException.Throw("Should remove the Chess first"); } point.Type = type; point.Block = new GoBlock(SIZE, point); return(point); }
public GoPoint(GoCoord coord, GoPointVisitor vistior) { coord_ = coord; vistior_ = vistior; type_ = GoPointType.EMPTY; }
public GoStep(GoCoord coord, GoPointType type) { coord_ = coord; type_ = type; }