Chatting like it's 1999! An open forum to discuss Hexcasting, and anything else made by petrak@'s mods, and also anything else else https://forum.petra-k.at/
This thread is for any interesting small tidbits I find that aren't worthy of making an entire thread for. (Feel free to talk in the thread if you like - I'll be building an index of my posts here to make them easy to find while still allowing folks to talk.)
Archer's Distillation, Rotation Gambit II, Architect's Distillation, Additive Distillation
Re: Math's Miscellanea
Posted: Sat Feb 18, 2023 2:51 am
by Math321
Bit Selector
Hexcasting's set operations do bitwise math if you apply them to numbers. Here's one practical way to use that in a hex.
Let's say you want a function which returns either True or False depending on what number you pass it, using this table:
0 = False
1 = False
2 = True
3 = True
4 = False
5 = True
6 = False
7 = True
First, you'll want to translate that table into binary, with bit 0 as the least significant bit (on the right). Then convert that number into decimal.
Binary: 10101100
Decimal: 172
From there, you can write some code that uses a bitmask to check whether the Nth bit of 172 is true or false.