Esempio n. 1
0
 private List <GoCoord> RemoveBlock(GoBlock block)
 {
     if (block == null || block.DianNumber == 0)
     {
         GoException.Throw("Attempt remove a NULL or EMPTY Block");
     }
     return(block.Remove());
 }
Esempio n. 2
0
        public GoBlock(int size, GoPoint dian)
        {
            size_ = size;
            type_ = dian.Type;
            ID    = ++mainid;
            if (dian.Block != null)
            {
                GoException.Throw("Attempt add a Dian to double Block");
            }
            int index = dian.Coord.GetIndex(size_);

            dianMap_.Add(index, dian);
            dian.Block = this;
            CleanQi();
            DetectNeighborBlock(dian, dian.UP);
            DetectNeighborBlock(dian, dian.DOWN);
            DetectNeighborBlock(dian, dian.LEFT);
            DetectNeighborBlock(dian, dian.RIGHT);
        }
Esempio n. 3
0
        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);
        }