Choore Door exercise

Was doing this exercise:

I believe there is a little mistake in logic of the game.
If you do all of the steps of this exercise at the end game doesn’t work as it should be.
When you click on pictures and picture of the bot shows up, game tells that game is over. BUT, if you click again, click counter keeps working! So if you click more times (pictures of the cards don’t change), game then says that you won!

I believe that the following condition was missed in this exercise in steps:
const playDoor = (door) => {
if (currentlyPlaying) {
if (numClosedDoors === 0) {
} else if (isBot(door)) {

Without it, once again, counter just kept counting…

Just wanted to double check if I’m right of if I missed something?


What you’re describing sounds a lot like step #50.



I thought so too. When I completed this step, player can’t click the same door, but he still can click on the other door. I will try to explain better. After implementing all of the steps this is what happened.

Let’s say when player clicked on the door, picture of the bot shows up, and button says: “game Over”. BUT, player can still click on the other door, they will not open, but button will change it’s message to :“you win”. Simply because counter keeps counting clicks, as there is no condition set for it in this exercise!

I just want to let know whoever made this exercise, so they can fix it.

Steps #63 - 65 implement the logic to prevent the player from continuing after finding the ChoreBot and converting a losing game to a win. :slight_smile:

Yes, I implemented that too. BUT, in the exercise there is no instruction to put it into the playdoor function, so counter will work only when currentlyPlaying is true. That is the problem!!!

Door won’t open, but click counter still works…

I don’t know. I still think it is not correct… Sorry.

You’re right, there is no instruction to put that logic into playDoor… because you’re asked to handle it in the .onclick event handlers for each door, like so:


doorImage1.onclick = () => {
  if (!isClicked(doorImage1) && currentlyPlaying) {
    doorImage1.src = openDoor1;

I did that. I put it into doorImage1.onclick function. But again, this logic prevents door to be opened when player clicks on it, not counter counting clicks…

playDoor() is the function which decreases the number of doors remaining, but if you’ve followed the instructions then this should not get called if either the door has already been clicked or the player has lost and the game is over. This is explicitly what it asks for in step 65.

If your game allows the player to continue after they’ve lost, you’ve overlooked some of the logic that the exercise asks for:

Steps 46 - 49 ask you to implement the playDoor() function, and to have it do the following:

  • Decrease the number of unopened doors by 1;
  • Check if the win condition has been reached, and call an as-yet-unwritten gameOver() function.

Steps 50 - 52 ask you to implement the isClicked() function to test if a door has been previously clicked.

Step 53 asks you to incorporate the “anti-cheat” isClicked() function into your .onclick() handlers for each door, making each of them clickable once only.

Steps 54 - 57 introduce the gameOver() function, and write the logic for the player achieving the win condition. At this stage, it’s still impossible to lose…

Steps 58 - 61 ask you to expand your code to test whether the player has found the ChoreBot with the isBot() function, and to add this to your playDoor() function.

Step 62 expands the gameOver() function to tell the player when they’ve lost, but it’s still not possible to lose because…

Steps 63 - 65 ask you to introduce the currentlyPlaying boolean value which determines whether the game is in progress, and whether your clicks count.