private void DoStateAction(PuzzleCellStateTypes markerState) { if (_cbxDirectionTypes.SelectedIndex < 0) { return; } DirectionTypes directionType = (DirectionTypes)_cbxDirectionTypes.SelectedItem; Point direction = PuzzleReferee.ConvertToPoint(directionType); Point markerPosition = new Point(_robotBrain.Position.X + direction.X, _robotBrain.Position.Y + direction.Y); _puzzleBoard.SetState(markerPosition, markerState); if (_cbxAutoRefreshPlayground.Checked) { RefreshPlayGround(); RecreateCells(); } }
private void SetValueAndState(Point position, Point distancePoint, PuzzleBoard patialBoard) { int width = patialBoard.Columns; int height = patialBoard.Rows; Point centerPos = new Point((width - 1) / 2, (height - 1) / 2); Point nextPosition = new Point(position.X + distancePoint.X, position.Y + distancePoint.Y); Point partialPos = new Point(centerPos.X + distancePoint.X, centerPos.Y + distancePoint.Y); int number = _puzzleBoard.GetValue(nextPosition); PuzzleCellStateTypes state = _puzzleBoard.GetState(nextPosition); patialBoard.SetValue(partialPos, number); patialBoard.SetState(partialPos, state); }