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); }
public virtual bool IsMustDie(GameBoard board, ShapeLocation curLocation) { return(board.GetNeighbours(curLocation).Count < MinRelationCount); }
public void setCurrentShapeLocation(ShapeLocation location) { repository.CurrentLoadingLocation = location; }