Chess-Coding-Adventure icon indicating copy to clipboard operation
Chess-Coding-Adventure copied to clipboard

Stats and last move on board shows from last game at the start of a new one.

Open AlexRiosJ opened this issue 4 years ago • 4 comments

You can see the stats for the previous game when you hit the button of a new game. May be a pretty easy fix, idk

image

AlexRiosJ avatar Feb 12 '21 16:02 AlexRiosJ

In the image, it seems that the squares of the last move are highlighted too

icecream17 avatar Feb 14 '21 03:02 icecream17

Cool project, I took a quick look - seems like a one-liner code change would fix the stale stats (moving to NewGame which is called from the main flow).

You can take the change from here: https://github.com/SebLague/Chess-AI/pull/2

gel avatar Feb 17 '21 22:02 gel

One suggestion: Write a test for this scenario.

Writing a test for each bug:

  • You immediately know when you fixed the issue because the test passes.
  • The bug will never happen again because you have a test to cover the scenario.
  • It provides you with an automated way to reproduce the bug.
  • You can't know that you have fixed the bug without being able to reproduce it.
  • If you make a mistake in following the steps to reproducing the bug then you might assume that you have fixed the bug, even though the bug is still there. What happened was a double mistake (the bug and the mistake in the repro steps canceled each other out).
  • The automated test never makes a mistake in following the repro steps. Writing one and using it is a way to know for sure that you have fixed the issue.

I'll see if I can put together a pull request for an automated test.

As @gel said, cool project!

brandon-busby avatar Feb 22 '21 17:02 brandon-busby

Hey everyone, check out my fix on this one

MEHRDADsmj avatar Sep 05 '22 12:09 MEHRDADsmj