SIC-1
SIC-1 is a free and open source single-instruction (subleq) programming game. Neglect your personal life in pursuit of promotions and vague assurances of job security! Optimize your programs to rise to the top of the leaderboards! SIC Systems thanks you for your hard work! Now please return to your desk.
Now also available on Steam: https://store.steampowered.com/app/2124440/SIC1/
- Learn an esoteric assembly language.
- Implement programs to unlock more impressive job titles.
- Optimize your programs to climb the leaderboards.
- Sacrifice your personal life for the good of the company!
It's an assembly language zachlike for everyone! New programmers will appreciate how few unique instructions there are to learn (just one!), and experienced programmers will appreciate how poorly suited this one instruction is for writing straight-forward programs.
If you're ready for a challenge, respond to this job posting from SIC Systems:
SIC Systems is hiring engineers to produce highly efficient programs for our 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 invent 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!
Links:
- Discord server
- Trailer
- Soundtrack
- Source code
- Solutions forum (spoiler alert!)
- Follow on: Mastodon, the web
Status | Released |
Platforms | HTML5 |
Rating | Rated 4.9 out of 5 stars (17 total ratings) |
Author | jaredkrinke |
Genre | Puzzle |
Tags | coding, programming, zach-like, zachlike |
Average session | A few minutes |
Languages | English |
Inputs | Keyboard, Mouse |
Links | Steam, Community |
Development log
- SIC-1 is looking for translators! (With 100% more Open Source)Jan 13, 2024
- Patch notes for Dec 28Dec 29, 2023
- Patch notes for Aug 12Aug 13, 2023
- Save data managementMar 25, 2023
- Hints and inline labelsFeb 19, 2023
- New puzzle, music, editor improvementsFeb 09, 2023
- Save slots and breakpointsJan 19, 2023
- Sandbox mode, alternative color schemesJan 11, 2023
Comments
Log in with itch.io to leave a comment.
I just finished the game on Steam and oh boy that was a journey. I spent countless hours on this over the last 3 days. Very well made.
My game isn't saving.
Are you on an iPad, by any chance? If not, which browser and OS?
If you're on iOS: the game is saved into "HTML Local Storage" in the browser, and unfortunately Apple changed the default settings on iOS to prevent saving data to localStorage when hosted cross-domain (as is done here on itch.io). This was ostensibly done for privacy reasons, but unfortunately it completely broke saves for browser-based games on itch.io for iOS. The only work-around for SIC-1 (short of disabling the "Prevernt cross-site tracking" setting--which I don't recommend doing, since it's a global setting) is to manually export your save data (Options -> Manage Save Data) and then import it next time.
If you're not on iOS: let me know the browser+OS and whether or not any settings (especially privacy/security settings) have been modified, and I'll give it a try.
I'm using chrome on windows 10, and I think it may not be the game's fault, because I've gotten errors attached to localStorage on other things, so it may be my google account.
EDIT: I read the big block of text for iOS, (because I like reading, I know, I'm a nerd. What did you expect?) and I saw the bottom: "The only work-around for SIC-1 (...) is to manually export your save data...". Well then, I guess I'll do that!
I think Chrome has a similar setting, but it is disabled by default. It might be called “block third party cookies”. It might be enabled by default in incognito mode.
I found the setting and have set it to "Block in incognito mode",
Thanks for the help!
Is it pronounced ess-eye-see-1 or sick-1?
“Sick 1” 🙂
A single instruction Zach-like sounds delightful, thanks for adding more cool programming puzzle games to the world :D
Personally I'd appreciate an option to view dark text on a light background. I understand if that goes against the theme of the game as being reminiscent of a particular period of computing hardware. (I had a similar issue with TIS-100...) I've half a mind to root around in the browser tools to see if I can edit it on the client side :P
I had not considered adding an optional “light mode”. Good idea, thanks!
Alternative color schemes are now available!
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!
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.
Ah, OK. Also, I was planning to save my programs for later on my machine. So what's the file extension I have to use to save these programs?
I would use “.txt”, given it is plain text and there aren’t any other programs that use SIC-1 Assembly Language 🙂
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?
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
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
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!
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:
can you put a walk through for Reverese Sequence?
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?
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?
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).
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!
Very Cool
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!
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?
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...
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
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?
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
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).
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.