TIS-100

TIS-100

Ver estatísticas:
Marc1314 28/jun./2016 às 14:14
I need help with the 3rd puzzle
hi, im not looking for a walkthrough but i need someone to to explain what im doing wrong.

edit: Steam has messed up my formatting but if you have completed the 3rd puzzle you'll understand!


I have tried to use this:
IN.A ------------------------------------IN.B

MOV UP, ACC--------------------- MOV UP, ACC
SUB RIGHT -------------------------SUB LEFT
MOV ACC, DOWN----------------MOV ACC, DOWN

My code stops working when both nodes reach the SUB instruction and they get stuck in read mode.

i've been messing about with it and trying different things but i still cant get the SUB instruction to work.

So im guessing there must be something blindingly obvious that i'm not getting or i've overlooked something, any chance you guys can help me out?
Última edição por Marc1314; 28/jun./2016 às 14:17
< >
Exibindo comentários 14 de 4
gecko 28/jun./2016 às 16:44 
You need to actually send the input around with MOV. Right now, node A is trying to read from B with its "SUB RIGHT" but B isn't sending anything. B is actually also trying to read from node A with its "SUB LEFT". That's what's called a deadlock: two pieces of code completely stuck, waiting on each other to complete.

You might be tempted to fix this by sending values before subtracting instead, but that fix will cause a deadlock too: both nodes will be trying to send instead of trying to receive, which isn't really any better. No, you need one node to send and one node to receive. This means the code won't be a perfect mirror.

There's an obvious problem with the result you'll be getting out of that though. A gets 15, B gets 5, B sends 5, A does (15 - 5) = 10, then A sends 10 to B. But B was really supposed to do 5 - 15 = -10. There's at least 3 possible solutions, some more efficient than others. I suggest trying to think of a solution for yourself, but here's some further hints:

There's nothing stopping you from sending the same value twice.
What if you kept A and B in one node, then did the math in a different one?
One possible solution: In the node directly below A, read UP to ACC once, then send the same ACC value down twice. In the node below B, just send UP to DOWN as normal. The A math node reads from UP, subtracts RIGHT, sends UP straight to RIGHT then sends its own result DOWN. The B math node reads from UP, sends its value LEFT, subtracts LEFT and sends its result DOWN.
Marc1314 29/jun./2016 às 9:50 
Ahhh! so when i want to subtract the ACC of the other node i need to command the other node to move the ACC that is being subtracted.

I was under the impression that i only needed to command node a to do this.

This is a great help, thanks turtle!
DwieSzopyJackson 15/out./2016 às 4:48 
in order to be able to read in a node, neighbouring node must be writing sth.
try sending acc to the other node before doing sub
mov up, acc
mov acc, right
sub right
mov acc, down
CondensedMilk 18/dez./2022 às 12:19 
I solved it using this code

IN.A
MOV UP ACC
SAV
SUB RIGHT
MOV ACC DOWN
SWP
MOV ACC RIGHT
IN.B
MOV UP ACC
SAV
MOV ACC LEFT
SWP
SUB LEFT
MOV ACC DOWN

so basically, the game wants a-b to go to output p and b-a to go to output n
so first we wanna solve output p
OUTPUT.P
1. IN.A takes its value and puts it into ACC
2. IN.A saved the value that is in ACC to BAK
3. IN.B sends takes its value and sends it to IN.A
4. IN.A uses SUB RIGHT to minus the IN.A value with IN.B thus a-b and solving output p
5. Finally, IN.A takes the finished value that is stored in ACC and moves it down to be sent to output p
6. IN.A swaps the saved value from step 2 and sends it to IN.B to solve output n



edit: sorry for necro didnt read the date
Última edição por CondensedMilk; 18/dez./2022 às 12:19
< >
Exibindo comentários 14 de 4
Por página: 1530 50