internal override List <Position> GetMovablePositions(Game game) { return(Position.Whole .Where(pos => pos.X == Position.X || pos.Y == Position.Y) .Where(pos => Position.Route(Position, pos).All(routePos => game.GetPieceAt(routePos) == null)) .Where(pos => !IsSameColor(game.GetPieceAt(pos))) .ToList()); }
internal override List <Position> GetMovablePositions(Game game) { return(Position.Halves[Color] .Where(pos => Position.Distance(pos, Position) == 4 && pos.X != Position.X && pos.Y != Position.Y) .Where(pos => { var route = Position.Route(Position, pos); if (route.Count != 1) { return false; } return game.GetPieceAt(route[0]) == null; }) .Where(pos => !IsSameColor(game.GetPieceAt(pos))) .ToList()); }
internal override List <Position> GetMovablePositions(Game game) { var list = new List <Position>(); list.AddRange(Position.Palaces[Color] .Where(pos => Position.Distance(pos, Position) == 1) .Where(pos => !IsSameColor(game.GetPieceAt(pos))) ); list.AddRange( new List <Position> { game.Pieces.First(piece => piece is General && piece != this).Position } .Where(pos => Position.X == pos.X) .Where(pos => Position.Route(pos, Position).All(routePos => game.GetPieceAt(routePos) == null)) ); return(list); }
internal override List <Position> GetMovablePositions(Game game) { var list = new List <Position>(); list.AddRange( Position.Whole .Where(pos => pos.X == Position.X || pos.Y == Position.Y) .Where(pos => Position.Route(Position, pos).All(routePos => game.GetPieceAt(routePos) == null)) .Where(pos => game.GetPieceAt(pos) == null) ); list.AddRange( Position.Whole .Where(pos => pos.X == Position.X || pos.Y == Position.Y) .Where(pos => game.GetPieceAt(pos) != null && !IsSameColor(game.GetPieceAt(pos))) .Where(pos => Position.Route(Position, pos).Count(routePos => game.GetPieceAt(routePos) != null) == 1) ); return(list); }