-
Notifications
You must be signed in to change notification settings - Fork 0
An attempt at some optimisations #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,14 +6,14 @@ import ContentPage from "./ContentPage"; | |||||||
| import MoveListTable from "../Chess/MoveListTable"; | ||||||||
| import MoveListInline from "../Chess/MoveListInline"; | ||||||||
|
|
||||||||
| function GameRow(props: { index: number; settings: Settings; game: Game, totalMoveRows: number, fullLength: Boolean }) { | ||||||||
| function GameRow(props: { settings: Settings; game: Game, otherGameMoves: number }) { | ||||||||
| const moves = props.game.moves.split(" "); | ||||||||
|
|
||||||||
| // Find the best variant to use to get the most out the move data. | ||||||||
| let size = "text-xs"; | ||||||||
|
|
||||||||
| return ( | ||||||||
| <div> | ||||||||
| <div className="mb-10"> | ||||||||
| <ChessBoard game={props.game} className="text-sm" /> | ||||||||
| <div className="mb-2"> | ||||||||
| <GameTitle | ||||||||
|
|
@@ -22,12 +22,12 @@ function GameRow(props: { index: number; settings: Settings; game: Game, totalMo | |||||||
| white={props.game.white} | ||||||||
| /> | ||||||||
| </div> | ||||||||
| {props.totalMoveRows > 35 * (Number(props.fullLength) + 1) && moves.length > 40 * (Number(props.fullLength) + 1) | ||||||||
| {(props.otherGameMoves + props.game.movesCount) < 65 * 2 | ||||||||
| ? ( | ||||||||
| <MoveListInline moves={moves} highlightedPly={props.game.board.ply} size={size} /> | ||||||||
| <MoveListTable moves={moves} highlightedPly={props.game.board.ply} size={size} columns="columns-2 gap-4" /> | ||||||||
| ) | ||||||||
| : ( | ||||||||
| <MoveListTable moves={moves} highlightedPly={props.game.board.ply} size={size} columns="columns-2 gap-4" /> | ||||||||
| <MoveListInline moves={moves} highlightedPly={props.game.board.ply} size={size} /> | ||||||||
| )} | ||||||||
| </div> | ||||||||
| ); | ||||||||
|
|
@@ -38,32 +38,42 @@ export default function SixGamePage(props: PageProps & { games: Game[] }) { | |||||||
| return b.movesCount - a.movesCount; | ||||||||
| }); | ||||||||
|
|
||||||||
| const totalMoveRows = sortedByMoveCountGames[0].movesCount + (sortedByMoveCountGames[3]?.movesCount ?? 0) / 2; | ||||||||
| const columns: [number, number | undefined][] = []; | ||||||||
| const offset = sortedByMoveCountGames.length - 1; | ||||||||
|
|
||||||||
| for (let i = 0; i < 3; i++) { | ||||||||
| if (!sortedByMoveCountGames[i]) { | ||||||||
| break; | ||||||||
| } | ||||||||
|
|
||||||||
| const newColumn: [number, number | undefined] = [i, undefined]; | ||||||||
| const key = offset - i; | ||||||||
| if (offset - 1 > 2 && sortedByMoveCountGames[key]) { | ||||||||
|
||||||||
| if (offset - 1 > 2 && sortedByMoveCountGames[key]) { | |
| // Pair the i-th game with the (length - 1 - i)-th game if there are enough games for a pair in this column | |
| if (sortedByMoveCountGames.length > i * 2 + 1 && sortedByMoveCountGames[key]) { |
Uh oh!
There was an error while loading. Please reload this page.