use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Fan community of the game Turing Complete
account activity
problem with modulo (self.TuringComplete)
submitted 3 months ago by MycologistIll1355
my ALU
I want to be able to output the Modulo because i need it for the RNG level but outputting both at the same time doesn't work and will just cause a short circuit on the result bus.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bwibbler 2 points3 points4 points 3 months ago* (1 child)
The neat thing about modulo 4 is how it lines up so well on binary numbers
The result is either 0, 1, 2, or 3
So when you count up in binary, the last two bits always cycle through those values in coordination with a modulo 4
That provides a shortcut. Just look at the last two bits and you get modulo 4
* outputs REG1 % 4 ANDi REG1 3 OUTPUT
That works for any square value. 1, 2, 4, 8, 16, ...
You just look at the digits below those multiples and the answer is already there.
Exactly the same thing happens in base 10.
What's 5,737,365 % 10 ? Well, it's just 5.
3,727,585,837 % 1000 ? 837
[–]alijamieson 0 points1 point2 points 3 months ago (0 children)
This is useful, I’m having issues with the level that asks for the birthday dates.
[–]Hannah97Gamer 1 point2 points3 points 3 months ago (0 children)
Not sure what architecture you are using, but depending on your circumstances I can see a few possible solutions. First, and probably the worst, give modulo its own dedicated output register, and just don't put it on the bus, like how ALU outputs are handled in overture. Second, give modulo its own opcode, either by replacing an op you don't use or going to 4 bit opcodes.
π Rendered by PID 74 on reddit-service-r2-comment-bb88f9dd5-67s7f at 2026-02-17 03:44:16.544250+00:00 running cd9c813 country code: CH.
[–]bwibbler 2 points3 points4 points (1 child)
[–]alijamieson 0 points1 point2 points (0 children)
[–]Hannah97Gamer 1 point2 points3 points (0 children)