Пример #1
0
        public virtual List <Step> GetNextSteps(Step curStep)
        {
            int           LocX = curStep.Board.CurrentShapeLocation.X;
            int           LocY = curStep.Board.CurrentShapeLocation.Y;
            int           NewLocX;
            int           NewLocY;
            List <Step>   Steps    = new List <Step>();
            GameBoard     newBoard = curStep.Board.Clone();
            ShapeLocation newLocation;

            foreach (StepOffset offset in Offsets)
            {
                NewLocX = LocX + offset.X;
                NewLocY = LocY + offset.Y;
                if (newBoard.MoveShape(NewLocX, NewLocY) == StepResult.Ok)
                {
                    newLocation = new ShapeLocation(NewLocX, NewLocY);
                    if (IsMustDie(newBoard, newLocation))
                    {
                        newBoard.RemoveShape(NewLocX, NewLocY);
                        Steps.Add(new Step(newBoard, StepResult.Die, double.MinValue));
                    }
                    else
                    {
                        Steps.Add(new Step(newBoard, StepResult.Ok, newBoard.Score(newLocation)));
                    }

                    newBoard = curStep.Board.Clone();
                }
            }

            return(Steps);
        }
Пример #2
0
 public virtual bool IsMustDie(GameBoard board, ShapeLocation curLocation)
 {
     return(board.GetNeighbours(curLocation).Count < MinRelationCount);
 }
Пример #3
0
 public void setCurrentShapeLocation(ShapeLocation location)
 {
     repository.CurrentLoadingLocation = location;
 }