Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

SIC-1 Solutions

Forum for posting SIC-1 solutions · By jaredkrinke

Odd solution for Addition

A topic by JaykTheJackal created 15 days ago Views: 41
Viewing posts 1 to 1

Came back to this game yesterday after like 2 years because I like some programming brain teasers sometimes. I reviewed what I had written for Addition.

This works but only because the case where it would fail is at the end of a Test:
.data 0, -3, 3
.data 0, -3, 6
.data -2, 0, 0

The solution that actually *should* work generally:
.data 0, -3, 3
.data 0, -3, 6
.data -2, 0, 9

I was scratching my head over why the first thing worked at all when reviewing it. All I had given was an unhelpful comment:

; instruction 0, 0, 0 -> sets first byte to 0, restarts

Think maybe I decided to get cheeky and failed to update the comment. But it seems to me the only reason this works is because you do not expect negative numbers aside from at the end of tests. And when a test ends, it gets reset.

[Yes it was using .data notation, probably for the achievement. Though I will say to past self ".data 0 -3 3 0 -3 6 -2" -- literally the same thing. Less legible but there are a lot of places I could've improved that so why start there really.]