Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Pollyanna
Mar 5, 2005

Milk's on them.


Jabor posted:

Yes, the "two instructions" are "check for a coin" and "if so, do something".

Just spend a few moments thinking about how you could put those together and I'm sure it will come to you.

Bonfire Lit posted:

The coin counter will only have at most one input high at any one time.

Oh my god it took me like an hour but I finally got it working.



I actually found a use for gen. I'm kind of proud of myself. I wonder what else I can do to improve on this design...

Adbot
ADBOT LOVES YOU

Jeffrey of YOSPOS
Dec 22, 2005

GET LOSE, YOU CAN'T COMPARE WITH MY POWERS

zedprime posted:

That's your biggest problem with a delayed start card?

slx on an empty port and slp 999 consume the same amount of power because a test cycle is only 46 cycles long. I punctuate dead controllers with double slp 999 | slp 999 for fun. It makes more sense on other dead cards I've made because they are usually memory loaders using every single port already.

I was mostly joking, I was assuming you put two slp 999s because you needed them but I'm not sure why I would think that.

Did the patch break stuff? I'm getting weird behavior in some places. Might just be my code but I don't think so. Times have definitely changed so copy + rerun your now-slower solutions.

PS: Drinking game:
I got a 7 instruction solution. It slows it down and uses two DX300s for me, but it works.

Fuzzy Mammal
Aug 15, 2001

Lipstick Apathy
Patch notes:

Today's update contains the following changes:
Instead of 3 fixed test runs and 1 random test run, the game now runs 8 fixed test runs. We're still trying to figure out what needs to be done for verification, but hopefully this will at least be a little less... random.
Fixed a bug where you could place some parts on input/output board terminals.
Fixed a bug where histograms wouldn’t display for Mac and Linux users.
Attempted to fix the PDF opening bug on Linux. Whether it actually works for everyone is yet to be seen. Why is this the hardest part about porting to Linux?
Fixed a bug where only comically low resolutions were available to Mac users with Retina screens.
Fixed a bug where the breakpoint instruction text was wrong for Mac users.
Fixed a bug where you could click the fullscreen button even when it wasn’t visible.
Fixed a bug where some developer hotkeys were accidentally left enabled.
Fixed a few typos and text content errors.



I'm not sure how I feel about verification. Perhaps think there should be two levels. One is the 'customer supplied' one that we have today and can be gamed by precognition. Another would be a complete fuzzer that ensures you meet the spec precisely.

Pollyanna
Mar 5, 2005

Milk's on them.


I'm seeing some odd behavior with non-blocking XBus connections. I've got a packet of three values coming in, but only two of them are actually going where they need to go - the third gets lost somewhere. In this picture, I'm expecting each of the MCs to have acc equal to 2, but one of them has it equal to -999 instead. Why does this happen?

Fuzzy Mammal
Aug 15, 2001

Lipstick Apathy
The first one is consumed by your teq instruction. You need to mov it to acc/dat first. I know :(

Pollyanna
Mar 5, 2005

Milk's on them.


Fuzzy Mammal posted:

The first one is consumed by your teq instruction. You need to mov it to acc/dat first. I know :(

:wtc: That is dumb as poo poo. Oh well, at least the fix is simple...?

zedprime
Jun 9, 2007

yospos

Fuzzy Mammal posted:

I'm not sure how I feel about verification. Perhaps think there should be two levels. One is the 'customer supplied' one that we have today and can be gamed by precognition. Another would be a complete fuzzer that ensures you meet the spec precisely.
In the end everyone just needs a level playing field for histograms/leaderboards. But it is kind of a poo poo or get off the pot because some of the problems have edge cases as sharp as a bat and it will take some extra doing to swat them all down compared to TIS-100 being firmly rooted in math problems.

It'd be neat if this game gets an addendum campaign, it nods into the personalities present by having a split between total corporate overlord and making bullshit and alternatively needing to make stricter solutions for the dystopic megacorp.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Perhaps there should be a score for how closely it meets the spec. You just need to pass the fixed examples to count it as "solved", but the third leaderboard could be about how many cases there are where it fails to do what the customer actually desires.

Would be a ton of effort writing something that could evaluate that metric, though.

Pollyanna
Mar 5, 2005

Milk's on them.


Are you expected to use RAM for the Aquaponics puzzle?

WhiteHowler
Apr 3, 2001

I'M HUGE!
I think my biggest roadblock is that you can't do real nested conditionals, or at least I haven't figured out a way that doesn't take a million extra commands and status flags.

Like, in a regular programming language I might do:

pre:
if (p0 > 0) {
     accvalue(1);
     if (p1 > 0) {
          datvalue(2);
     } else {
          datvalue(3);
     }
} else {
     accvalue(4);
}
And I can't wrap my head around how to do this in Shenzhen. Uhh...

pre:
  tgt p0 0
- mov 4 acc
+ mov 1 acc
+ tgt p1 0
+ mov 2 dat
- mov 3 dat
Maybe? I dunno. That might work, but there are a lot of cases where I can't make them work without using a bunch of jmp commands.

Pollyanna
Mar 5, 2005

Milk's on them.


WhiteHowler posted:

I think my biggest roadblock is that you can't do real nested conditionals, or at least I haven't figured out a way that doesn't take a million extra commands and status flags.

Like, in a regular programming language I might do:

pre:
if (p0 > 0) {
     accvalue(1);
     if (p1 > 0) {
          datvalue(2);
     } else {
          datvalue(3);
     }
} else {
     accvalue(4);
}
And I can't wrap my head around how to do this in Shenzhen. Uhh...

pre:
  tgt p0 0
- mov 4 acc
+ mov 1 acc
+ tgt p1 0
+ mov 2 dat
- mov 3 dat
Maybe? I dunno. That might work, but there are a lot of cases where I can't make them work without using a bunch of jmp commands.

I'm pretty awful at this myself too so I can't give much advice, but supposedly it's easier to handle with tcp and delegating to helper MCs.

OddObserver
Apr 3, 2009

Pollyanna posted:

Are you expected to use RAM for the Aquaponics puzzle?

It's solvable efficiently w/o any. .

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It's relatively easy to do things like "if A and B and C...":

code:
  tgt acc, 19
+ tlt acc, 31
+ # do the thing

It's when you want to do complex stuff like "if A and B do X, if A and not B do Y, otherwise do Z", which is usually where I start breaking out the jmp s.

Pollyanna
Mar 5, 2005

Milk's on them.


OddObserver posted:

It's solvable efficiently w/o any. .

I'm having a little trouble figuring out what to do once I get the # of station to move to. I need to be able to record what my current and previous stations are, but also do some math to find the distance/how much to move and where, and sub and friends are destructive so acc and dat are unreliable. Am I just misunderstanding the requirements again?

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
One insight that might be helpful is that subtraction is reversible. You can reconstruct the number you "lost" simply by adding things back together again.

OddObserver
Apr 3, 2009

Pollyanna posted:

I'm having a little trouble figuring out what to do once I get the # of station to move to. I need to be able to record what my current and previous stations are, but also do some math to find the distance/how much to move and where, and sub and friends are destructive so acc and dat are unreliable. Am I just misunderstanding the requirements again?

Do you really need to figure out how many steps you need to move?

Pollyanna
Mar 5, 2005

Milk's on them.


OddObserver posted:

Do you really need to figure out how many steps you need to move?

Well, yeah. The test expects the motor to "move" (100-50 or 0-50 pulse) by (destination - origin) steps. For example, if the robot is at Station 2 and you receive an order to move to Station 5, the test data says the motor should take three rightward steps. That means I should make sure my robot takes that many steps. Is that not correct?

As for how to do it without figuring out how many steps you need to take, there's no way to programmatically tell what station you're currently at, so you can't exactly iterate until you reach your destination. At least, I don't see an input for it anywhere...

OddObserver
Apr 3, 2009

Pollyanna posted:

Well, yeah. The test expects the motor to "move" (100-50 or 0-50 pulse) by (destination - origin) steps. For example, if the robot is at Station 2 and you receive an order to move to Station 5, the test data says the motor should take three rightward steps. That means I should make sure my robot takes that many steps. Is that not correct?

As for how to do it without figuring out how many steps you need to take, there's no way to programmatically tell what station you're currently at, so you can't exactly iterate until you reach your destination. At least, I don't see an input for it anywhere...


Maybe telling too much:
My solution just kept track of what station I was at.

zedprime
Jun 9, 2007

yospos
You can iterate in conditional loops. You probably want to make a while loop with conditionals. While I am behind my target, travel forward until I'm not. While I am ahead of my target, travel backwards until I'm not.

More explicitly, in my solution that's not going to receive any histogram awrads, I had a controller who's job was to keep track of where it is at in acc. It receives updates from the master controller and places it in dat. If acc > dat, I sent a signal to a separate motor controller that moved back one spot, and updated acc accordingly. Same for acc < dat but other direction. Iterate on acc using commands on the motor controller until acc = dat.

Jeffrey of YOSPOS
Dec 22, 2005

GET LOSE, YOU CAN'T COMPARE WITH MY POWERS

WhiteHowler posted:

I think my biggest roadblock is that you can't do real nested conditionals, or at least I haven't figured out a way that doesn't take a million extra commands and status flags.

Like, in a regular programming language I might do:

pre:
if (p0 > 0) {
     accvalue(1);
     if (p1 > 0) {
          datvalue(2);
     } else {
          datvalue(3);
     }
} else {
     accvalue(4);
}
And I can't wrap my head around how to do this in Shenzhen. Uhh...

pre:
  tgt p0 0
- mov 4 acc
+ mov 1 acc
+ tgt p1 0
+ mov 2 dat
- mov 3 dat
Maybe? I dunno. That might work, but there are a lot of cases where I can't make them work without using a bunch of jmp commands.
This is my biggest problem too. You can't easily reverse conditionals either, because there's no tne,tge,or tle. That would save me a bunch of cycles on a few puzzles.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Jeffrey of YOSPOS posted:

This is my biggest problem too. You can't easily reverse conditionals either, because there's no tne,tge,or tle. That would save me a bunch of cycles on a few puzzles.

You can flip the order of operands to get effectively X-or-equal, though the tense obviously isn't the same if you're trying to build compound expressions.

Jabor fucked around with this message at 04:34 on Oct 11, 2016

Guy Axlerod
Dec 29, 2008
http://i.imgur.com/Jd6GIX7.gifv


I made this golf game. I also don't know how to make a good recording.

Hell Yeah
Dec 25, 2012

probably a stupid question, but can anyone explain to me why i keep getting "part not sleeping" on the mc6000 chip up front on this infrared sensor machine:



I've tried a bunch of things to fix it but i keep getting that part sleeping. it runs until it's time to send a signal to the mc4000 that reads the sensor and activates the alarm. as soon as the alarm is supposed to activate i get part not sleeping

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
You don't ever read the value it sends out.

Every time you write to an xbus, the chip will wait for someone to read that value. This doesn't count as sleeping. Since nothing ever reads that value, the chip just gets stuck.

Ignoranus
Jun 3, 2006

HAPPY MORNING

Hell Yeah posted:

probably a stupid question, but can anyone explain to me why i keep getting "part not sleeping" on the mc6000 chip up front on this infrared sensor machine:



I've tried a bunch of things to fix it but i keep getting that part sleeping. it runs until it's time to send a signal to the mc4000 that reads the sensor and activates the alarm. as soon as the alarm is supposed to activate i get part not sleeping

The "slx" command only detects that there is a packet being sent on the x0 input - it doesn't actually do anything WITH the input from x0, so the 6000 is trying to send something but it's not getting received.

Hell Yeah
Dec 25, 2012

so is moving the x0 input on the second chip after it wakes up into the acc the best way to solve that? just to do something with the signal?

fomo sacer
Feb 14, 2007

WhiteHowler posted:

I think my biggest roadblock is that you can't do real nested conditionals, or at least I haven't figured out a way that doesn't take a million extra commands and status flags.

Like, in a regular programming language I might do:

pre:
if (p0 > 0) {
     accvalue(1);
     if (p1 > 0) {
          datvalue(2);
     } else {
          datvalue(3);
     }
} else {
     accvalue(4);
}

And I can't wrap my head around how to do this in Shenzhen. Uhh...

pre:
  tgt p0 0
- mov 4 acc
+ mov 1 acc
+ tgt p1 0
+ mov 2 dat
- mov 3 dat

Maybe? I dunno. That might work, but there are a lot of cases where I can't make them work without using a bunch of jmp commands.
A useful trick I've found is you can write tcp 0 0 to clear the comparison flag, so your example becomes
pre:
  tgt p0 0
- mov 4 acc
- tcp 0 0 # clear flag so we don't execute mov 3 dat
+ mov 1 acc
+ tgt p1 0
+ mov 2 dat
- mov 3 dat
Basically, nested conditionals get a whole lot easier once you realize you have a break-style command. It doesn't save space over jmp, but it makes sorting the logic out a lot easier, especially if you're trying to use the comparison flag to store state.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Hell Yeah posted:

so is moving the x0 input on the second chip after it wakes up into the acc the best way to solve that? just to do something with the signal?

Anything at all, really.

Note that there's a bonus register that silently eats everything you put into it, so the usual instruction for "read from x0 but ignore the value" is mov x0 null.

Hell Yeah
Dec 25, 2012

thanks, the chips not sleeping anymore btw now i have a different problem that i think i'll be able to figure out on my own.

Fuzzy Mammal
Aug 15, 2001

Lipstick Apathy
Instead of passing a dummy value and writing it to null you can often pass the initial loop count or the first value in a chain or some other init type data too.

Fuzzy Mammal
Aug 15, 2001

Lipstick Apathy
I found a way to make a zero power oscillator!

A not chip looping back on itself will produce a single 100 value then advance one sleep unit. Pass that plus the output of an xor unit back into the xor unit and voila. To avoid the "pin connected to itself" error break up the paths with or units.

Every time an xbus operation happens elsewhere it will flip too, but it's usually predictable whether you'll have an even or odd number of those per sleep cycle.

New Zealand can eat me
Aug 29, 2008

:matters:


Here's my wireless gaming controller, real simple and straightforward

Ratzap
Jun 9, 2012

Let no pie go wasted
Soiled Meat
If they keep fiddling around with the verification, I suspect that before the game comes out of early access they'll nuke the scores database. The histograms people see when they buy the game will need to reflect what they can actually achieve with what they purchased rather than what was possible with a beta version.


I was playing last night and realised my biggest problem is thinking in production mode like I'm working. Instead of trying to design something to pass verification, I sit there thinking about edge cases and how to make it robust.

homeless snail
Mar 14, 2007

Yeah, they blew up the leaderboards on TIS before it left early access, also

nielsm
Jun 1, 2009



New Zealand can eat me posted:

Here's my wireless gaming controller, real simple and straightforward



You can easily save several lines of code here, and even improve performance.

Check e.g. your MC4000 connected to X-Y.
code:
t: teq x0 -1
- slp 1
- jmp t
+ mov p0 x0
+ mov p1 x0
+ slp 1
Line 3, the jmp. If you remove that it would still do the same thing: All the following lines have + condition while the jmp has - condition, so those lines would be skipped anyway.
After removing that line, you notice that both the + branch and - branch end in a "slp 1" instruction, so you can remove the - branch one and remove the condition from the + branch one turning it unconditional.
Result:
code:
t: teq x0 -1
+ mov p0 x0
+ mov p1 x0
  slp 1
Simpler and tighter.

Even more efficient (power-wise) would be to replace the slp with slx so the chip isn't constantly polling, but then you'd also have to change the logic of the connecting chip.

WhiteHowler
Apr 3, 2001

I'M HUGE!
I'm having an issue with the Virtual Reality Buzzer.

My first two lines are:
teq x0 -999
- mov x0 dat

x0 is connected to the RX pin of the sensor, and I do see the correct signals appearing on the wire. But for some reason, when the second line executes, it always puts -999 into dat.

I've also tried:
teq x0 1
+mov x0 dat

And it also puts -999 into dat when it executes.

Which makes no sense, but I think I'm missing something important.


Edit: Wait, is this happening because it's asking for a new chunk of data off the XBus every time I reference x0?

fomo sacer
Feb 14, 2007

WhiteHowler posted:

I'm having an issue with the Virtual Reality Buzzer.

My first two lines are:
teq x0 -999
- mov x0 dat

x0 is connected to the RX pin of the sensor, and I do see the correct signals appearing on the wire. But for some reason, when the second line executes, it always puts -999 into dat.

I've also tried:
teq x0 1
+mov x0 dat

And it also puts -999 into dat when it executes.

Which makes no sense, but I think I'm missing something important.


Edit: Wait, is this happening because it's asking for a new chunk of data off the XBus every time I reference x0?

Yes. Using an xbus value in any operation consumes the packet, so typically you need to either save the value to a register or figure out a way to only poll the xbus once.

fomo sacer fucked around with this message at 14:57 on Oct 11, 2016

WhiteHowler
Apr 3, 2001

I'M HUGE!

Static Equilibrium posted:

Yes. Using an xbus value in any operation consumes the packet, so typically you need to either save the value to a register or figure out a way to only poll the xbus once.
Yep, got it. Managed to finish with a single MC6000, though my power usage is pretty high.

I should stop trying to optimize everything and just work on progress, I guess.

nielsm
Jun 1, 2009



WhiteHowler posted:

I'm having an issue with the Virtual Reality Buzzer.

Tip to simplifying things: Do you ever get an "off" command that doesn't have a matching "on" command before it? Or two "on" commands in a row?

Adbot
ADBOT LOVES YOU

GotLag
Jul 17, 2005

食べちゃダメだよ
Jesus Christ. I was just about to post "I wish labels didn't have to be on their own lines" when I realised I'd just assumed that out of nowhere, despite knowing it wasn't the case in TIS-100.

http://i.imgur.com/f9FW2.mp4

Edit: time to re-do all my branching dumpster fire loops with JMPs

GotLag fucked around with this message at 16:03 on Oct 11, 2016

  • Locked thread