freeCodeCamp icon indicating copy to clipboard operation
freeCodeCamp copied to clipboard

platformer game (js beta) step 84 and step 88 (and step 89) check is too strict

Open hbar1st opened this issue 1 year ago • 1 comments

Describe the Issue

In the platformer game's (js beta) step 84 (and step 88), the step expects us to write this new line of code

      player.position.x >= platform.position.x - player.width / 2

but doesn't accept this equally valid variation (at least in my view, it is valid):

      player.position.x >= platform.position.x - (0.5 * player.width)

When we provide the variation above, the hint also does not provide any help to direct us to what it needs us to write. (Note that the instructions also do not make mention of a specific method for getting "half of the player's width" so it is open to interpretation there too) please note other steps have similar issues but with different numbers (like step 89)

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-84 https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-88 https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-89

Your code

as above.

Expected behavior

Either fix the check to allow users to multiply by 0.5 (in addition to divide by 2) or update the text of the step and the hints to be more explicit about a division operator being a requirement to finding half the width.

Screenshots

No response

System

N/A

Additional context

There's a similar problem in step 85, but it is mitigated there by the hint which actually says that we should divide by 3. (on my first attempt, I multiplied by 1/3 which was not accepted)

Also whatever fix is done for step 84 should apply to step 88 too as they have the same issue. Please also look at updating step 89 checks/hints as well to match whatever decision is reached here. (either update the hint to be like step 85 and say that division is required or update the step's checks to allow multiplication by 1/3)

hbar1st avatar Aug 11 '24 16:08 hbar1st

even if the regex code is fixed code like this wouldn't work should I care about it or not ?

  player.position.x >= platform.position.x - (0.5 * 2 /2 player.width)

I know no one should right code like this but if someone does should I find another way to check or not?

TofikE124 avatar Aug 13 '24 08:08 TofikE124

I suggest we add the following line to each of the instructions: Use the division operator (/) to calculate half of the player's width. (steps 84, 88). We will modify the hints if necessary to match the context.

StephenMuya avatar Jan 18 '25 16:01 StephenMuya

@Sembauke Is this issue still open for collaboration? And if it is, could you please tell my why @TofikE124's pull request was closed, was there any issue with his pull request? https://github.com/freeCodeCamp/freeCodeCamp/pull/55837

agilan11 avatar Jan 22 '25 07:01 agilan11

My guess is he took long to work on the merge conflicts. They had to pull it down to allow others to present their PRs.

StephenMuya avatar Jan 22 '25 07:01 StephenMuya

@agilan11 yes, i thas the "help wanted" label so it is open for contributions. we close abandoned PRs to allow others to open PRs to contribute to issues

majestic-owl448 avatar Jan 22 '25 09:01 majestic-owl448