From be6d686e59a7ff9be00be9eb3151ce8c3d10707c Mon Sep 17 00:00:00 2001 From: GideonPotok Date: Wed, 6 Mar 2024 13:40:36 -0500 Subject: [PATCH 1/6] made fix --- ui/analyse/src/ctrl.ts | 4 ++++ ui/analyse/src/practice/practiceCtrl.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/analyse/src/ctrl.ts b/ui/analyse/src/ctrl.ts index d8b05638e48d0..c0edbe32a00ee 100644 --- a/ui/analyse/src/ctrl.ts +++ b/ui/analyse/src/ctrl.ts @@ -277,6 +277,10 @@ export default class AnalyseCtrl { return opposite(this.bottomColor()); } + playerColor(): Color { + return this.data.game.player; + } + bottomColor(): Color { if (this.data.game.variant.key === 'racingKings') return this.flipped ? 'black' : 'white'; return this.flipped ? opposite(this.data.orientation) : this.data.orientation; diff --git a/ui/analyse/src/practice/practiceCtrl.ts b/ui/analyse/src/practice/practiceCtrl.ts index 12d401b37deb2..36d61448305ae 100644 --- a/ui/analyse/src/practice/practiceCtrl.ts +++ b/ui/analyse/src/practice/practiceCtrl.ts @@ -136,7 +136,7 @@ export function make(root: AnalyseCtrl, playableDepth: () => number): PracticeCt } function isMyTurn(): boolean { - return root.turnColor() === root.bottomColor(); + return root.turnColor() === root.playerColor(); // root.data.game.player; } function checkCeval() { From 2f1d5f48e3c0467dbac3708937c616888c711e26 Mon Sep 17 00:00:00 2001 From: Gideon Potok <31429832+GideonPotok@users.noreply.github.com> Date: Wed, 6 Mar 2024 18:03:44 -0500 Subject: [PATCH 2/6] Update ui/analyse/src/practice/practiceCtrl.ts --- ui/analyse/src/practice/practiceCtrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/analyse/src/practice/practiceCtrl.ts b/ui/analyse/src/practice/practiceCtrl.ts index 36d61448305ae..116e84969a817 100644 --- a/ui/analyse/src/practice/practiceCtrl.ts +++ b/ui/analyse/src/practice/practiceCtrl.ts @@ -136,7 +136,7 @@ export function make(root: AnalyseCtrl, playableDepth: () => number): PracticeCt } function isMyTurn(): boolean { - return root.turnColor() === root.playerColor(); // root.data.game.player; + return root.turnColor() === root.playerColor(); } function checkCeval() { From 6efc69b1265b0c565dafbdaa1f8249d42440c890 Mon Sep 17 00:00:00 2001 From: GideonPotok Date: Thu, 7 Mar 2024 08:48:24 -0500 Subject: [PATCH 3/6] Made the change have less of a blast radius. --- ui/analyse/src/practice/practiceCtrl.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/analyse/src/practice/practiceCtrl.ts b/ui/analyse/src/practice/practiceCtrl.ts index 116e84969a817..5b540bad62210 100644 --- a/ui/analyse/src/practice/practiceCtrl.ts +++ b/ui/analyse/src/practice/practiceCtrl.ts @@ -136,7 +136,11 @@ export function make(root: AnalyseCtrl, playableDepth: () => number): PracticeCt } function isMyTurn(): boolean { - return root.turnColor() === root.playerColor(); + if (root.data.game.variant.key === 'racingKings'){ + return root.turnColor() === root.playerColor(); + } else { + return root.turnColor() === root.bottomColor(); + } } function checkCeval() { From 62557ef83fb7f6bc7931dcb34736be6697df39f1 Mon Sep 17 00:00:00 2001 From: GideonPotok Date: Thu, 7 Mar 2024 09:30:57 -0500 Subject: [PATCH 4/6] pnpm format --- ui/analyse/src/practice/practiceCtrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/analyse/src/practice/practiceCtrl.ts b/ui/analyse/src/practice/practiceCtrl.ts index 5b540bad62210..cc4e28e0a91bb 100644 --- a/ui/analyse/src/practice/practiceCtrl.ts +++ b/ui/analyse/src/practice/practiceCtrl.ts @@ -136,7 +136,7 @@ export function make(root: AnalyseCtrl, playableDepth: () => number): PracticeCt } function isMyTurn(): boolean { - if (root.data.game.variant.key === 'racingKings'){ + if (root.data.game.variant.key === 'racingKings') { return root.turnColor() === root.playerColor(); } else { return root.turnColor() === root.bottomColor(); From d0eaa1a4c6c5106767df06abbd2432573de6e7de Mon Sep 17 00:00:00 2001 From: GideonPotok Date: Thu, 7 Mar 2024 09:54:54 -0500 Subject: [PATCH 5/6] use ternary operator --- ui/analyse/src/practice/practiceCtrl.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/analyse/src/practice/practiceCtrl.ts b/ui/analyse/src/practice/practiceCtrl.ts index cc4e28e0a91bb..b91edef8ca30b 100644 --- a/ui/analyse/src/practice/practiceCtrl.ts +++ b/ui/analyse/src/practice/practiceCtrl.ts @@ -136,11 +136,10 @@ export function make(root: AnalyseCtrl, playableDepth: () => number): PracticeCt } function isMyTurn(): boolean { - if (root.data.game.variant.key === 'racingKings') { - return root.turnColor() === root.playerColor(); - } else { - return root.turnColor() === root.bottomColor(); - } + return ( + root.turnColor() === + (root.data.game.variant.key === 'racingKings' ? root.playerColor() : root.bottomColor()) + ); } function checkCeval() { From b0745cf1279819557ea1ad5ec842008d88b2ae6d Mon Sep 17 00:00:00 2001 From: GideonPotok Date: Thu, 7 Mar 2024 10:31:23 -0500 Subject: [PATCH 6/6] made playerColor Dependent on orientation (but the default orientation will correspond to your original color --- ui/analyse/src/ctrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/analyse/src/ctrl.ts b/ui/analyse/src/ctrl.ts index c0edbe32a00ee..e0c2c2c01a482 100644 --- a/ui/analyse/src/ctrl.ts +++ b/ui/analyse/src/ctrl.ts @@ -278,7 +278,7 @@ export default class AnalyseCtrl { } playerColor(): Color { - return this.data.game.player; + return this.flipped ? opposite(this.data.game.player) : this.data.game.player; } bottomColor(): Color {