internal override List <Position> GetMovablePositions(Game game) { return(Position.Palaces[Color] .Where(pos => Position.Distance(pos, Position) == 2 && pos.X != Position.X && pos.Y != Position.Y) .Where(pos => !IsSameColor(game.GetPieceAt(pos))) .ToList()); }
internal override List <Position> GetMovablePositions(Game game) { return(Position.Whole .Where(pos => Position.Distance(pos, Position) == 1) .Where(pos => game.GetPieceAt(pos) == null) .SelectMany(middlePos => { int diffX = middlePos.X - Position.X; int diffY = middlePos.Y - Position.Y; if (diffX != 0) { return new List <Position> { new Position(middlePos.X + diffX, Position.Y - 1), new Position(middlePos.X + diffX, Position.Y + 1) }; } else { return new List <Position> { new Position(Position.X - 1, middlePos.Y + diffY), new Position(Position.X + 1, middlePos.Y + diffY) }; } }) .Where(pos => Position.IsOnTable(pos)) .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); }