src/PaperSoccerAI/GameBoard.cs
/// <summary>
/// Checks if movement from selected point in the selected direction is in bounds 
/// of the game board.
/// </summary>
/// <param name="p">starting point</param>
/// <param name="dir">direction of movement</param>
/// <returns>true if the checked move is in the bounds of the board</returns>
Checks if movement from selected point in the selected direction is in bounds
of the game board.
Checks if movement from selected point in the selected direction is in bounds of the game board .
private bool MoveDirectionValid(Point p, Direction dir) {
			if (dir == Direction.UpRight) {
				if (p.X == width - 1 || p.Y == 0)
					return false;
				return true;
			}
			if (dir == Direction.Right) {
				if (p.X == width - 1 || p.Y == 0 || p.Y == height - 1)
					return false;
				return true;
			}
			if (dir == Direction.DownRight) {
				if (p.X == width - 1 || p.Y == height - 1)
					return false;
				return true;
			}
			if (dir == Direction.Down) {
				if (p.X == 0 || p.X == width - 1 || p.Y == height - 1)
					return false;
				return true;
			}
			if (dir == Direction.DownLeft) {
				if (p.X == 0 || p.Y == height - 1)
					return false;
				return true;
			}
			if (dir == Direction.Left) {
				if (p.X == 0 || p.Y == 0 || p.Y == height - 1)
					return false;
				return true;
			}
			if (dir == Direction.UpLeft) {
				if (p.X == 0 || p.Y == 0)
					return false;
				return true;
			}
			if (dir == Direction.Up) {
				if (p.X == 0 || p.X == width - 1 || p.Y == 0)
					return false;
				return true;
			}
			throw new AIException("Unhandled move direction!");
		}
private bool MoveDirectionValid ( Point p , Direction dir ) { if ( dir == Direction . UpRight ) { if ( p . X == width - 1 || p . Y == 0 ) return false ; return true ; } if ( dir == Direction . Right ) { if ( p . X == width - 1 || p . Y == 0 || p . Y == height - 1 ) return false ; return true ; } if ( dir == Direction . DownRight ) { if ( p . X == width - 1 || p . Y == height - 1 ) return false ; return true ; } if ( dir == Direction . Down ) { if ( p . X == 0 || p . X == width - 1 || p . Y == height - 1 ) return false ; return true ; } if ( dir == Direction . DownLeft ) { if ( p . X == 0 || p . Y == height - 1 ) return false ; return true ; } if ( dir == Direction . Left ) { if ( p . X == 0 || p . Y == 0 || p . Y == height - 1 ) return false ; return true ; } if ( dir == Direction . UpLeft ) { if ( p . X == 0 || p . Y == 0 ) return false ; return true ; } if ( dir == Direction . Up ) { if ( p . X == 0 || p . X == width - 1 || p . Y == 0 ) return false ; return true ; } throw new AIException ( " " ) ; }
Checks if movement from selected point in the selected direction is in bounds
of the game board.
Checks if movement from selected point in the selected direction is in bounds of the game board .
true if the checked move is in the bounds of the board
true if the checked move is in the bounds of the board
p
Point
None
dir
Direction
direction of movement
direction of movement