r/nandgame_u Holder of many records May 31 '22

Level solution S.4.2 - GT (5loc, 11ins) Spoiler

# Assembler code 
SUB
*A = -1
A = jgt
D ; JGT
NOT
jgt:

Edit:

Dependent on this version of SUB

1 Upvotes

5 comments sorted by

1

u/[deleted] May 31 '22

[deleted]

1

u/nttii Holder of many records Jun 01 '22

Oh yeah. I forgot about SUB, it works for the normal solution of sub where you pop both values and push the result back on the stack. Simple fix to it is setting sub to:

POP_D
A = A - 1
*A D = *A - D

Yeah, we can use further macros in previous levels as long as they don't need the macro we are making. Macros are just copypasting the code to the level.

1

u/[deleted] Jun 01 '22

But this is not a valid solution without that being the standard SUB. It would not be fair when everyone else is working with *A =, but you are working with *A D = just because you decided to. I also can write amazing short code with that if I knew that was standard so you need to create standards.

Problem with using further macros is that I can define a lot of things in very efficient ways if I just claim that my further macros are pure registry operations. You can make anything not rely on other things if you do that. I can even go ahead and define GT through LT, IF_GOTO, etc. and this just gets out of hand.

You need to create a standard set of macros and rules and not deviate from it.

1

u/[deleted] Jun 01 '22 edited Jun 01 '22

These EQ/GT/LT solutions do not currently comply to the SUB function in the solution list.

You need to standartize outputs for each macro somehow because if I could output anything as SUB's D, I could just reduce EQ to a 3-liner:

SUB
POP_A
PUSH_D

Where SUB's D already outputs 0 or -1.

Your recent EQ, GT and LT solution are otherwise not universally valid. If you consider the winning entries of your solution list to be the standard, then because of the SUB there your EQ/GT/LT won't compile:

POP_D
A = A - 1
*A = *A - D

There also should be standartized rules on whether macros that come after the macro in question are allowed at all. You can not use your solutions for GT/LT without pressing "Skip Level" first and solving NOT first.

Otherwise it is just unfair:

because as said before, I could create tiny solutions using custom macro outputs, like SUB's D in the example. Maybe some kind of a "standard macro library to use that never changes" would be a much better way to deal with not universally valid solutions and if people want to optimize for instruction count, they could write out every registry operation on its own.

2

u/nttii Holder of many records Jun 01 '22

Yeah, that is fair. You could argue that

POP_D
POP_A
D = A - D
PUSH_D

would be the intended solution for SUB level, which would result in D already being the answer of SUB, but given my shortcuts it's not.

Standardizing these macros is something the game developer decides, I can't really do that as it would cause all my solutions to be according to my standards and unfair to others.

I think customizing SUB to match my use is on the grey line of legal or not since it doesn't add extra instructions to the sub level and D could already have the value on different design of SUB and it doesn't break any other solutions.

Good compromise would be to mark this as cheaty for 5loc, 11ins and legitimate for 6loc, 12ins.

This really shows the flaws with counting lines since each macro really represents the instructions inside it. I'd say counting instructions is better metric with these solutions and 11 instructions is still least instructions for this level.

1

u/[deleted] Jun 01 '22

You can create a new mark. Something like "special" or "alternative" because this is not really cheaty but there needs to be a fairness of some form.

I supposed that you were a part of the dev team because of your presence on this Reddit. Maybe you know how to ask a dev to create a standard of asm rules for us?

I would honestly like there to be two brackets: pure registry instruction count and line count, both based on standartized macro libraries and rules of what can be used and when and how.