Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/Turing/TuringLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ export const TuringLog: React.FC<{ embedded?: boolean }> = ({
? 'White was the bot'
: game.result?.bot === 'black'
? 'Black was the bot'
: // Not the game's result: it would give the
// answer away before the guess.
'Awaiting your guess'}
: game.termination.winner === 'white'
? 'White wins'
: game.termination.winner === 'black'
? 'Black wins'
: game.termination.winner === 'none'
? 'Draw'
: 'Game in progress'}
</p>
{game.result?.ratingDiff !== undefined && (
<div className="flex items-center">
Expand Down
67 changes: 29 additions & 38 deletions src/pages/turing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ const Turing: React.FC<Props> = (props: Props) => {
},
}

// The result stays hidden until the guess is in: who won, and how (a
// checkmate or a resignation), says much about which side was the bot.
const resultShown = !!game.result
const termination = resultShown ? game.termination : undefined

const launchContinue = useCallback(() => {
const fen = controller.currentNode?.fen

Expand All @@ -140,17 +135,15 @@ const Turing: React.FC<Props> = (props: Props) => {
iconClassName="!text-xs"
/>
</div>
{termination && (
<span>
{termination.winner === 'white' ? (
<span className="text-engine-3">1</span>
) : termination.winner === 'black' ? (
<span className="text-human-3">0</span>
) : (
<span className="text-secondary">½</span>
)}
</span>
)}
<span>
{game.termination.winner === 'white' ? (
<span className="text-engine-3">1</span>
) : game.termination.winner === 'black' ? (
<span className="text-human-3">0</span>
) : (
<span className="text-secondary">½</span>
)}
</span>
</div>
<div className="flex w-full items-center justify-between gap-2 text-sm">
<div className="flex items-center gap-1">
Expand All @@ -161,28 +154,26 @@ const Turing: React.FC<Props> = (props: Props) => {
iconClassName="!text-xs"
/>
</div>
{termination && (
<span>
{termination.winner === 'black' ? (
<span className="text-engine-3">1</span>
) : termination.winner === 'white' ? (
<span className="text-human-3">0</span>
) : (
<span className="text-secondary">½</span>
)}
</span>
)}
<span>
{game.termination.winner === 'black' ? (
<span className="text-engine-3">1</span>
) : game.termination.winner === 'white' ? (
<span className="text-human-3">0</span>
) : (
<span className="text-secondary">½</span>
)}
</span>
</div>
</div>
<div className="mt-2 text-center text-xs text-secondary">
<span className="font-semibold uppercase tracking-wider">
{termination
? termination.winner !== 'none'
? `${termination.winner} wins`
: 'draw'
: 'Result shown after your guess'}
</span>
</div>
{game.termination && (
<div className="mt-2 text-center text-xs text-secondary">
<span className="font-semibold uppercase tracking-wider">
{game.termination.winner !== 'none'
? `${game.termination.winner} wins`
: 'draw'}
</span>
</div>
)}
</>
)

Expand Down Expand Up @@ -234,7 +225,7 @@ const Turing: React.FC<Props> = (props: Props) => {
<div className="relative bottom-0 min-h-[38px] flex-1 overflow-hidden">
<MovesContainer
game={game}
termination={termination}
termination={game.termination}
embedded
heightClass="h-full"
/>
Expand Down Expand Up @@ -301,7 +292,7 @@ const Turing: React.FC<Props> = (props: Props) => {
<div className="relative bottom-0 flex-1 overflow-hidden">
<MovesContainer
game={game}
termination={termination}
termination={game.termination}
embedded
heightClass="h-full"
/>
Expand Down
Loading