Asenna Steam
kirjaudu sisään
|
kieli
简体中文 (yksinkertaistettu kiina)
繁體中文 (perinteinen kiina)
日本語 (japani)
한국어 (korea)
ไทย (thai)
български (bulgaria)
Čeština (tšekki)
Dansk (tanska)
Deutsch (saksa)
English (englanti)
Español – España (espanja – Espanja)
Español – Latinoamérica (espanja – Lat. Am.)
Ελληνικά (kreikka)
Français (ranska)
Italiano (italia)
Bahasa Indonesia (indonesia)
Magyar (unkari)
Nederlands (hollanti)
Norsk (norja)
Polski (puola)
Português (portugali – Portugali)
Português – Brasil (portugali – Brasilia)
Română (romania)
Русский (venäjä)
Svenska (ruotsi)
Türkçe (turkki)
Tiếng Việt (vietnam)
Українська (ukraina)
Ilmoita käännösongelmasta
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.
I was under the impression that i only needed to command node a to do this.
This is a great help, thanks turtle!
try sending acc to the other node before doing sub
mov up, acc
mov acc, right
sub right
mov acc, down
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