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

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!

Update:

SIC-1 is coming to Steam (for Windows). Add it to your wishlist if you'd like to be notified when it's released: https://store.steampowered.com/app/2124440/SIC1/

Updated 2 days ago
StatusReleased
PlatformsHTML5
Rating
Rated 4.9 out of 5 stars
(7 total ratings)
Authorjaredkrinke
GenrePuzzle
Tagscoding, programming, zach-like, zachlike
Average sessionA few minutes
LanguagesEnglish
InputsKeyboard, Mouse
LinksSteam, Community

Development log

View all posts

Comments

Log in with itch.io to leave a comment.

How do I remove my save data?

Do you mean your saved programs/progress or your leaderboard scores?

For your code and whatnot, it’s stored in HTML Local Storage in the browser (on your computer). Deleting it is different by browser, but for Chrome open dev tools with F12, go the Application tab, and delete the entries that start with “sic1_”. Clearing browser history also deletes it, but that also deletes all your browser history, which you probably don’t want.

For deleting leaderboard data, I haven’t published the instructions yet, but the instructions will be in the next update (coming next weekend). If that’s what you’re looking for, let me know which browser you’re using and I can try and give you instructions that will work on the current version (there’s no UI for this in the current version).

Also, if you don’t mind sharing, why do you want to remove your saved data? If you think you hit a bug or something, let me know!

(2 edits)

It's not that I encountered a bug. I just wanted to revert my solutions for the problems into their original state (I deleted the comments, basically, which made it much more difficult for me to understand what to do). 

Also, is there anyway to download the game into another system not via itch.io? I downloaded the game from GitHub, but the game wouldn't open. 

That makes sense, thanks! I have plans to add a "reset" button that would restore the original code, but that work isn't done yet. If you don't mind potential spoilers, you can just search for the puzzle name in this file to see the original comments: https://github.com/jaredkrinke/sic1/blob/master/sic1/shared/puzzles.ts

As far as downloading, right now itch.io is the only option. If you use Steam on Windows, SIC-1 is releasing there (also for free) on Friday (with cloud saves). I don't have any other release plans. For the record, GitHub only has the source code and there are compilation steps required, so that unfortunately won't work for playing, in general.

Several weeks ago similar idea came to my mind. However, instead of full game, I made single challenge. I was thinking about how to measure complexity of algorithms including all possible dependencies (libraries, OS, CPU) and subleq appeared as ideal method for it. Subleq is relatively fast and still very basic.

For testing of such idea, I selected lossy image compression task: it is easy to check if resulting image is good and it gives lots of possibilities for implementation of different algorithms and optimizations. Because image data occupies large amount of RAM, I selected 32 bit address size and 32 bit data size.

If someone wants complex challenge (amount of code + data for solution is ~50k-200k), I suggest to look at it:

Subleq image decoder - Stack Exchange

SLIF - GitHub

How does the ranking system work? I keep seeing that I'm 1/17XX

Does everyone who completed all 30 levels see that they are #1? Or is it the average ranking on all levels? Or is it the last person to complete the game that gets the #1 title?

(1 edit)

Everyone with the same number of tasks completed sees the same rank.

On the web leaderboard the relative order between people with 30 tasks completed is arbitrary. Maybe I should make it alphabetical or something just so people don’t waste time trying to improve their position 🙂

Edit: maybe the web leaderboard should just be a “hall of fame” for everyone who completed all the tasks.

ingenious

(2 edits) (+1)

Hi

Wasn't expecting this to get updated. After beating this game a while ago I got very inspired. I felt like there was one aspect of the game that was missing. I really wanted this game to have more program space and the requirement to write actual functions. So I made my own macro assembler :)

It basically has the same functionality SIC-1 has but with more readable syntax, and macross. Here's some example code

function sub(a,b)
{
    b,a,?+1
}
function set(a, b)
{
    !var temp 0
    clear(a)
    clear(temp)
    sub(temp, b)
    sub(a, temp)
}
function add(a, b)
{
    !var temp 0
    clear(temp)
    sub(temp, b)
    sub(a, temp)
}


It all just compilers down to subleq It's quite satisfying to write in. I've made a lot of cool stuff with it.

cool thing. (does something interesting, see for yourself ;) )

So yeah! Thank you for introducing me to this strange language!

Also I haven't published the assembler anywhere yet, but if someone wants it you can dm me

I almost went down this path in my initial attempt to beat the final puzzle (to make sure it was indeed possible to beat). For the record, I think writing your own compiler is fair game for something like this. Nice work!

I just published a relatively large update that includes improved graphics, many fixes, and some under-the-hood changes. Post a comment if you run into any issues, thanks!

Fixed a bug that would crash them game if a new player reloaded the page. If the game didn't work for you, please try again!

(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!

Just released an updated client that resets the simulation (and stats) when advancing to the next test set. This is similar to what is done server side, and should prevent this trick (except for the handful of "tutorial" assignments that don't validate solutions using random data).

One additional note: prior to February 2020, it was possible to submit hard-coded output like this and make it onto the histograms. This is no longer possible, but I have to go back and clean up the histograms.

I'm also planning to see if I can, as you suggested, reset the machine for each set of tests (just need to ensure this doesn't break legitimate solutions).

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).

Just published an update that addresses this. "@IN" is now supported in either (or both) of the first two address slots:

  • "subleq @foo, @IN, @bar" is the most common case and works the same as before
  • "subleq @IN, @foo, @bar" will read an input, subtract @foo from it, and then branch if the result is less than or equal to zero (and note that the input is not saved anywhere, obviously, so it basically disappears)
  • "subleq @IN, @IN, @bar" will only read the input once, and it will always branch to @bar because the result of subtracting a number from itself is always zero), and again, the input value is not saved anywhere

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 1 year 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

I never replied here, but there's a solution up now for reference.