SHENZHEN I/O

SHENZHEN I/O

Vezi statistici:
Is there a simple way to divide by 10? (Not just dgt 1; 100 -> 10)
Hey—I'm stuck on a level in the bonus campaign and just can't seem to get past it. My solution is almost complete for voltage values 0-99 but fails if the input is 100, because "dgt 1" will return zero, and the program treats the value as if it were between 0-9.

Due to the way things are set up, I don't really seem to have the space to add anything else which could help. My chips are pretty much full of code, except for one line that I can spare—But since it's only one line I can't do teq acc 100, +mov 99 acc.

Is there a better hack that I can use to divide by ten? If I was able to convert 100->10 in one or two instructions (and, obviously, all other values into their tens digit) it would perfectly solve my issue but I just can't seem to figure out a way to lop off the ones digit and leave the other two both intact.

Thanks for any advice.
< >
Se afișează 1-9 din 9 comentarii
If you have space for a DX300 spare, you can often use that as a hacky way to check. It's been a while since i played, so no real good advice here.

(I sympathize, never got past puzzle 4 in the bonus campaign)
Editat ultima dată de thewifiwhisperer; 2 ian. 2023 la 3:10
Grim 2 ian. 2023 la 19:00 
Postat inițial de thewifiwhisperer:
If you have space for a DX300 spare, you can often use that as a hacky way to check. It's been a while since i played, so no real good advice here.

(I sympathize, never got past puzzle 4 in the bonus campaign)
I'm not completely sure I understand what you're suggesting?
If you can send the data to the 'x0' of a DX300, then you should get 100 only from the p1 pin, if divisible by 10 and not 100. otherwise pin p0 and p2 will also give output.

This requires a lot of space you don't have. (for both the DX300 and for some NOT/AND logic.)
gbors 14 nov. 2023 la 12:09 
Probably too long overdue, and I also can't divide by 10, however, I can help with this specific problem if you have space for two instructions.

Postat inițial de Grim:
If I was able to convert 100->10 in one or two instructions (and, obviously, all other values into their tens digit) it would perfectly solve my issue but I just can't seem to figure out a way to lop off the ones digit and leave the other two both intact.

teq acc 100
+mov 10 acc

I know, it's ugly. But it works.
Editat ultima dată de gbors; 14 nov. 2023 la 12:10
Grim 14 nov. 2023 la 20:33 
Postat inițial de gbors:
Probably too long overdue, and I also can't divide by 10, however, I can help with this specific problem if you have space for two instructions.

Postat inițial de Grim:
If I was able to convert 100->10 in one or two instructions (and, obviously, all other values into their tens digit) it would perfectly solve my issue but I just can't seem to figure out a way to lop off the ones digit and leave the other two both intact.

teq acc 100
+mov 10 acc

I know, it's ugly. But it works.
Yeah I don't think that would work for me. You can see in my post that I tried to do something similar (except with 99 instead of 10, so that 100 would map to 9) but I just don't have the room for it.

I can't just subtract 1 from each number either, because then if a number is, say, exactly 20, it would turn into 19, and dgt 1 would return 1 instead of 2.
gbors 14 nov. 2023 la 22:45 
Ah yes, I was focusing on the 3rd paragraph and didn't pick up on the second.
Then how about this instead of dgt 1:
mul 10
dgt 2

As 100*10 will be 999, it will give you the expected result on all inputs in the top digit - however, I don't know how dependent your code is on having the result in the middle digit.
Grim 14 nov. 2023 la 22:46 
Postat inițial de gbors:
Ah yes, I was focusing on the 3rd paragraph and didn't pick up on the second.
Then how about this instead of dgt 1:
mul 10
dgt 2

As 100*10 will be 999, it will give you the expected result on all inputs in the top digit - however, I don't know how dependent your code is on having the result in the middle digit.
Wait really? That works? Give me a minute to try it out.

This might take a while because I forgot how this code works. At some point I solved the level, idk how. Now I need to remind myself what eldritch nonsense I programmed.
Editat ultima dată de Grim; 14 nov. 2023 la 22:54
Grim 14 nov. 2023 la 23:07 
You're an insane genius. I would've never thought to abuse the number cap. Feels like it should be against the rules, but then I guess that's how a lot of Zach's games work. Had to fiddle with the code a little bit to figure out where I actually needed to PUT the multiply command but it worked when I figured it out. Thanks!
gbors 14 nov. 2023 la 23:37 
Well, after posting without reading properly, I felt kinda obliged to come up with something that actually works :D

Yes, most Zachtronics games rely on your finding shortcuts at various levels of preposterousness - Shenzhen IO probably even more than the others. And while I don't always like this, I have to admit that it's very accurate of a game simulating a job at a Chinese microelectronics company.

Glad that the solution worked!
< >
Se afișează 1-9 din 9 comentarii
Per pagină: 1530 50