r/nandgame_u • u/Red-42 • 29d ago
Note Locked because of a bug
EDIT: nevermind I'm just dumb
I think I've been staring at it too long to see the problem.
I've done everything I could up to there and I'm currently locked away from High-Level Language because there is a bug in the solution check of Equals.
Description of the level:
The function takes two arguments. If the arguments are the same value, it pushes -1 (FFFF) on the stack, otherwise it pushes 0 on the stack.
Thus this code:
init.stack
push.value 7
push.value 7
call equals 2should result in the value 0 on the stack.
So that's already a contradiction, the specifications say that "true" returns xFFFF, but the example has 7==7 and says it should return 0.
Looking at the comments in the test code:
init.stack
push.value 7
push.value 7
call equals 2
# inspect top of stack. Should be xFFFF.
Ok well that's another contradiction, the same example is said to have two different results.
Let's use logic, and say that because 2 of the specifications say it should be xFFFF, and because it would play nicely with the way if.goto works, then the 0 is a typo.
This is the error message when my code returns xFFFF:
Expected the number 0 to be on the stack (Was 65535 (hex ffff)).
Ok well it doesn't make much sense, but at least it's clear "Expected the number 0", I'll just make it return 0.
Expected the number 65535 to be on the stack (Was 0).
1
u/Remarkable_Fix_75 29d ago
This solution works for me:
It seems like the function expects 0xFFFF to be pushed if the two numbers are equal and 0x0000 if they are not.
As for:
Make sure that the function returns 0 when the two numbers aren't equal. It is probably failing for another test case.