src/PaperSoccerAI/GameBoard.cs
/// <summary>
/// This method can check all board conditions before performing a move.
/// </summary>
/// <param name="dir">direction of movement, from the ball</param>
/// <param name="startingPoint"></param>
/// <param name="validateMove">if true, board conditions are checked</param>
/// <returns>true if adding an edge succeded</returns>
This method can check all board conditions before performing a move.
This method can check all board conditions before performing a move .
private bool AddToBoard(Direction dir, Point startingPoint, bool validateMove) {
			if (validateMove && !MoveDirectionValid(startingPoint, dir))
				return false;
			var pt = GetBoardEdges(startingPoint);
			var edge = pt.GetValue(dir);
			if (validateMove && (edge == null || edge == true))
				return false;
			pt.SetValue(dir, true);
			Direction opDir = Tools.GetOpposite(dir);
			SetBoardEdge(Tools.GetPoint(startingPoint, dir), opDir, true);
			return true;
		}
private bool AddToBoard ( Direction dir , Point startingPoint , bool validateMove ) { if ( validateMove && ! MoveDirectionValid ( startingPoint , dir ) ) return false ; var pt = GetBoardEdges ( startingPoint ) ; var edge = pt . GetValue ( dir ) ; if ( validateMove && ( edge == null || edge == true ) ) return false ; pt . SetValue ( dir , true ) ; Direction opDir = Tools . GetOpposite ( dir ) ; SetBoardEdge ( Tools . GetPoint ( startingPoint , dir ) , opDir , true ) ; return true ; }
This method can check all board conditions before performing a move.
This method can check all board conditions before performing a move .
true if adding an edge succeded
true if adding an edge succeded
dir
Direction
direction of movement, from the ball
direction of movement from the ball
startingPoint
Point
None
validateMove
bool
if true, board conditions are checked
if true board conditions are checked