SIC-1 is a free single-instruction (subleq) programming game with "zachlike" global leaderboards.

Introduction:

You have been hired by SIC Systems to produce highly efficient programs for their flagship product: the Single Instruction Computer Mark 1 (SIC-1).

The SIC-1 represents a transformational change in computing, reducing complexity to the point that the processor only executes a single instruction: subtract and branch if less than or equal to zero ("subleq").

Enter the brave new world of single-instruction computing and discover new ways of implementing programs that would be trivial on a conventional computer. Don't adjust the technology to match how you think, adjust your thinking to match how the SIC-1 operates!

Feel free to share solutions at this link: https://jaredkrinke.itch.io/sic-1-solutions (spoiler alert, obviously)

StatusReleased
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(6)
Authorjaredkrinke
GenrePuzzle
Tagscoding, programming, zach-like, zachlike
Average sessionA few minutes
LanguagesEnglish
InputsKeyboard, Mouse

Development log

Comments

Log in with itch.io to leave a comment.

(1 edit)

since cycles and bytes are only counted for the first set of inputs optimization scores are really easy to abuse, its often possible to output the requirements for the first test above the actual programed solution. This is especially easy to do on the last level due to the nature of the levels challenge.

its been awhile since a played other zach-likes but if I remember correctly they usually use the score your solution scored the worst on. Though here the program doesn't reset between tests so I'm not sure if that's do-able.

Thanks! There is some logic to filter out these kinds of submissions on the server, to avoid showing them to other players (the submitter will still see their scores, however, as in your screenshot).

Having said that, the current filtering mechanism is not perfect, so some determined player could certainly get their bogus scores to appear on those histograms (side question: if someone goes through that much trouble, should I be flattered?). I could add a heuristic that tests programs on random inputs to make sure they're similar to the fixed inputs.

I don't know if this is possible with the way the game is set up, but what I would recommend is simply restarting the players solution on the second set of tests. The way I abused the system was simply hard coding the correct output for the first test above the actual solution, if the program where to run from the start for the second set of tests that hard coded output would cause the solution to fail.

I haven't looked at the code in a while, but it's likely that that is exactly what I'm doing on the server side. It would make sense to do the same thing on the client side (I don't recall if there was a reason for the discrepancy), although that could potentially break some existing solutions. Regardless, thanks for flagging this for me!

I think I ran into a (documentation?) bug. The very first "program" mentions the following: "@IN (253): Reads a value from input (writes are ignored)"

Writes are not, in-fact, ignored, it is it's use as a second argument to a subleq instruction that is special cased, or so it appears. When used as the first argument, it actually reads and modifies memory, as can be seen in the memory view!

I'm not sure if anyone else's solutions relies on this behavior, but it prevents an optimization I was hoping to try on one level.

You're right that there's a bug. Thanks for bringing it to my attention!

My original intent was to have writes to @IN be ignored, but it looks like I never actually implemented that behavior. I'm inclined to fix the bug (someday...), but I want to see if anyone's existing solutions depend on the current behavior.

just to confirm, with the bug fixed, `subleq @IN, something, something` would perform a read from the queue, and branch according to the subtraction result, then discard the result? (that's what my expectation would be, at least)

If you wanted to do something more special/possibly useful, you could make this read not advance the queue, acting as a kind of 'peek' operation. depending on the (theoretical) underlying hardware, this could be either a kludgy special case, or rather elegant to add. just an idea i had because of the current behavior which doesn't actually touch the queue at all (for a while i was wondering if it was acting as a peek for some reason, before realizing it was interacting with memory), meaning that as long as no solution relies on @IN acting as memory, choosing whether to advance the queue or not in this case is a decision left up to the designer (i.e. you).

can you put a walk through for Reverese Sequence?

(1 edit)

The "reverse sequence" puzzle is very similar to the "stack memory" puzzle, with the difference that you need to check for the zero that denotes the end of the sequence (and later also output a zero).

Does that help?

Edit: check the solutions forum if you're still stuck.

Done! Solved!

Sorry for blog posting in here. It's 6:30 am and I shouldn't've stayed up for so long. I can't feel my brain

I wrote comments for my code. Should I post it here?

Congrats! I’m consistently surprised that people have the perseverance to solve that last puzzle.

I’d actually love to see your code, but I’d prefer to avoid spoilers just below the game on this page :)


Let me think about if there’s a good place to post solutions…

I've uploaded my solution to github. "SIC-1-Self-Hosting-Solution" 

I created a forum on itch.io for sharing solutions: https://jaredkrinke.itch.io/sic-1-solutions

UGHHH! OKAY!

I'm fighting the final puzzle and for a while I was convinced that your tests are wrong. I even ran the program on paper. It seems like everything should work. That's the most EVIL final test. The "subleq 254 0 3"! Since I placed the program after my own code and applied offsets, all values went out of the window. The test not only wants to get the program to modify itself, it also wants the program to be at a correct place... idk if it makes sence but I guess I'll have to restructure a lot of code. 

Which SUCKS cause it passes every other test

Oh! i'm in top 10 players now!

I'll eventually get to the top 

Nice! Be aware that the final puzzle is a doozy :)

Really cool… just added to my collection! Would you like to join Creactivity #1?

(1 edit)

Before I start to reinvent the wheel.

Are the inputs in "Mode" puzzle in second test as low as in the first test? 

Inputs in test one are from 0 to 3

Is it the same in other tests? or will it hit me with 0-100? 

Do I have to write a HashMap or just use inputs as offsets

I should make it more clear in the instructions, but the numbers can be large (> 100).

Ok, I'm stuck on sorting :D

The worst part is that I know how most of the sorting algorithms work, but I just can't fit my program into 253 bytes...

What algorithm do you recommend to use? I chose Bubble cause it seemed like it would be very simple to code

Nevermind XD

I managed to save the my alg by making it ONE BYTE SMALLER! 

That’s the spirit! :)

For the record, I just inserted in order, shifting values down as needed.

Can I download this? I really like it so much.

One option is to download the game using the Itch App: https://itch.io/app

Note that you'll have to manually copy-paste your solutions from your browser into the downloaded version of the game. Eventually, I'd like to make it possible to share between browser and app, but there is at least one bug in the Itch App that prevents this from working with an Itch account.

It's not available as an .exe file. It opened in my browser.

Just so I understand, why were you looking for an EXE/stand-alone version of the game?

You're correct that there is no EXE; SIC-1 is a browser-based game for now. A desktop version could probably be built using Electron, but I don't have plans to do so. Launching from the Itch app sort of does this (it should open a new window that, while a web view, isn't just a normal browser window); it might even work offline (although all the leaderboards and whatnot won't work since they require Internet access).

Will my progress on the app be saved and will I be able to see my progress in my browser?

(+1)

Sadly, no. The workaround is to just copy-paste your solutions.

I’m hoping to implement that eventually, but I haven’t done the work yet and there’s a bug in the Itch app that prevents it from working seamlessly anyway (although I have an active pull request with them on GitHub to fix that part).

Deleted 315 days ago

I think the design of the In/Expected/Actual table is the problem here. Think of each column as just an ordered list of numbers. For Addition, you just read 2 values sequentially from input and then output their sum. For example, the first 4 inputs (ABCD) are: 1, 1, 1, 2. The expected outputs are A+B (1 + 1 = 2) and C+D (1 + 2 = 3). Note that there are 2 inputs for every 1 output in that puzzle.

For the Sign Function question, try stepping through your computation while watching the "Label / Value" table on the right side. Is it possible a variable is not being erased between loops?

For Division, similar to Addition, just consider input and output as ordered lists. In the case of Division, you just need to write to @OUT twice (first the quotient, then the remainder). The instructions for each task should be explicit about the order of inputs and outputs; if they're not, let me know!

(1 edit)

Very Cool

(+1)

Great game!

Can anyone explain how SIC-1 calculates cycle and byte counts? When Single stepping the cycle counter increments for ever step but the cycle count in the final score is much lower. Also I wanted to optimise the bytes read, but I can't work out how it deduces the number of bytes for each instruction.

Cheers!

(+1)

Sorry I didn’t notice your question until now!

Cycles are counted only for the first set of inputs/outputs (because subsequent tests use random data and the statistics need to be comparable across runs).

For memory bytes, there are 256 possible addresses on the SIC-1 and the statistic represents the number of those addresses that were accessed during the first test set (regardless of the number of times each addressed was accessed). The idea is that it’s the maximum amount of memory required to run the program. Note: each subleq instruction is 3 bytes.

I'm seeing referrals from a Google Classroom. Any idea what class this is for? If you'd rather not share publicly, you can contact me directly at sic1@schemescape.com. Thanks!

Hello,I've been playing on my PC without an itch.io account and I want to play this game on my laptop. If I log in my account on my PC and my laptop will I be able to save my progress?

Unfortunately, all the data is stored locally in the browser’s HTML Local Storage. I’d suggest just saving all your solutions (e.g. email them to yourself) and paste them in on your new device.

Creating an account system is something I’d like to do, but I was waiting to see if there was interest in the game first :)

Update: In the future, I'd like to use itch.io accounts and the itch.io app for "cloud saving" of solutions/settings. At the moment, however, there are a couple of blocking issues in the itch.io app (and the version of Electron the app uses). The bottom line is that this won't be available for quite some time, unfortunately.

Dude, could ypu make this a mobile app?

(+1)

I considered supporting mobile, but I didn’t think programming on a platform where the on-screen keyboard takes up half the screen (leaving maybe 10 - 20 lines of text visible) would be enjoyable.  Let me play around with the layout a bit more...

(+1)

Update: mobile is now "supported" in that the styling for the itch.io-hosted browser version of the game now reflows the UI in a single column (instead of the three column layout used on desktop/landscape mode).

Let me know if you think this is playable, thanks!

I love it, thank you!

If you get stuck on any puzzle (even the last one), feel free to post a comment. It's possible the game's instructions just aren't clear (or there's a typo). I want the game to be difficult and tedious, but not unclear/impossible :)

Just noticed (based on a surge of new players) that SIC-1 was mentioned in a YouTube video by Truttle1 that explains what subleq is and how it works (note that the order of arguments in SIC-1 is slightly different than what is used in Truttle1's video): https://youtu.be/FvwcRaE9yxc

(+1)

Hey, do you think you could somehow implement TOGA (TOGgle bit And jump if true) logic for a series of side puzzles, along with support for macros?

(+2)

If there's interest in a sequel! :)

There is, at least from me!

This is one of the best programming games I have ever played! The rating system kinda reminds me of Zachtronics games :D

(+1)

Thanks! Glad you liked it. It's encouraging to hear that at least one other person finds single-instruction programming to be an enjoyable challenge.

And yes, the ranking system is inspired by various games from Zachtronics (including my personal favorite: TIS-100).

(+1)

Kudos to whoever it was that recently completed the "Reverse Sequence" puzzle -- I haven't even done that one yet!

have you solved it? if yes put it in the solutions forum