Custom Base Calculator in Gimkit

new slim guide just dropped :fire:

Introduction

:information_source: This guild is approx. 2-4% memory, depending on several factors. I used 6-7% memory testing it, making sure certain values were correct that didn’t appear in the game.

Base 10 is the dominant counting technique we use as humans. The numerals of base 10 are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. When we get to 9, we have no numerals left in one-digit numbers. We start over from the beginning, so 01 right? Not exactly. Putting 0 before any number like 01 just converts it to 1. Now, we need to proceed to our next number, 1. We start over, now we’re at 10. When trying to understand other bases, do not say ten. Instead, say one zero. This guide is not about base 10 folks, it’s about other bases besides base 10. You presumably know base 10 because that’s our everyday counting technique. What if we had a base other than 10? What about 5? Well, base 5 proceeds as follows: 0, 1, 2, 3, 4. Once we run out of numbers, we restart to the beginning, 10. [1] Binary runs on base 2. It goes 0, 1, 10, 11, 100, 101, 110, 111, 1000. What if we go larger than base 10? How about base 11? It would be 0-9, but add another value: a. [2] Here are some math problems below in base 11, and watch a video here to learn more.

9 + 1 = a

a + 1 = 10

6 + a = 15

20 + a = 2a


This guide expands the use of my last guide.


Part 1 of 3:

Finished Product of Both Parts

The only way this is possible is we convert the currently selected base into base 10, then back into our currently selected base. Let’s say we are in base 11. We make a list of all the one-digit numbers. [3] 0 = 0, 1 = 1, and so on. What do we do when we get to a? Well, 9 = 9, so we get the next digit, which is 10; a = 10. Now why does this work? Let me explain- in the code, we get the letter number. a is the 10th numeral in line [4], so getting letter number 10 [5] would get us a. That, my friend, is exactly how the basic premise of what this code does. Wow, so cool!

Part one focuses on building the calculating part, while part two focuses on inserting custom inputs mid-game. Part 3 sets up the counter and text for answer, 1st input, 2nd input, etc.

First, set up some properties. Reference the table below to find each one.

Property Name Property Type Default Value
alphabetMax text 0123456789abcdefghijklmnopqrstuvwxyz
selectedAlphabet text none
input1 text none
input2 text none
answer text none
leftoverChecking true/false false
inputOverall number 0
"tens" number 1
"hundreds" number 1
counter number 0
countCounter number 0
baseNumberA number 0
baseNumberB number 0
Bulk of properties
Property Name Property Type Default Value
0 number 0
1 number 1
2 number 2
3 number 3
4 number 4
5 number 5
6 number 6
7 number 7
8 number 8
9 number 9
a number 10
b number 11
c number 12
d number 13
e number 14
f number 15
g number 16
h number 17
i number 18
j number 19
k number 20
l number 21
m number 22
n number 23
o number 24
p number 25
q number 26
r number 27
s number 28
t number 29
u number 30
v number 31
w number 32
x number 33
y number 34
z number 35

Step 1

Place a trigger. The only setting you need to change is trigger when receiving on. Set that to math. This trigger will run whenever a math calculation needs to be completed.


Step 2

Create a block code section inside the trigger you just placed. Before we start, copy these variables into your code. These variables are essential for getting under the block limit.


Step 3

Add this if statement below the variables. This is working a bit backward because this trigger does the last half of the calculations to fit certain blocks. The inputOverall property gives us the actual result, but it might say 23 places over in the ones spot. If we had base 10, that would be 23, but the game doesn’t know it has a number greater than 10 yet. It just knows it has 23 ones, so this piece of code subtracts the appropriate number from the ones and adds +1 to the tens. Now it knows it has 1 ten, and 13 ones. It does it a second time; the result is 2 tens and 3 ones, creating 23 in the answer.

Are You following yet? Okay, good.


Step 4

Bring in the rest of the code by setting up the answer property. selectedAlphabet has the list of the currently selected base. It gets the letter # of the ones, tens, and hundreds place. Lastly, it broadcasts messages on updateAnswer

Correcting any mistakes.

I noticed some mistakes in my code, but it still works. First, move the broadcast message on channel: math right after the set property value: combinedMath block.

Then, move set property value: answer and broadcast message on channel: updateAnswer inside the else.

Double-check that everything is correct, and that is the end of part 1! Wahoo! :partying_face:


Part 2 of 3:

This is the second part, which can customize the inputs mid-game and the first half of the calculations. This system can support two inputs, both 2-digit numbers. If you want a 1-digit number, put a 0 before one or both inputs.


Step 1

Place a second trigger. It should trigger when receiving on triggerSetup1. Then, create a new block code inside the trigger. Insert the variables according to the image below. Continue to step 2.


Step 2

We are using a single counter to set everything up. The number the counter represents is plac.ed in the property counter. There is quite a handful of stuff that the counter changes. To keep track of what value we need to change, we increment a property called countCounter. Fantastic name, me. Jokes aside, this first if statement should always run first.

The player sets the custom base number first. If the counter shows the number 2, then the selectedAlphabet should be set to 01. If you didn’t know, alphametMax [6] is set to 0123456789abcdefghijklmnopqrstuvwxyz. To set the property to 01, it’s really quite simple. Get a substring from the first letter to the letter # of the counter. Remember, the counter should show 2 when trying to get 01, as in base 2.

For a later time, we need to set baseNumberA and baseNumberB to the values in the image. The - sign in baseNumberA is a negative sign, found in the math branch. I will explain later why we need them.


Step 3

so much typing ahh

The rest of the if statement is so similar, that I decided to combine it into one step.

Add three else ifs to the if statement. This is making both inputs using one property. If the first input is 12, and the second is 2b, then it combines to create 122b. We can separate it back out later.

Do you remember me saying that we always add +1 to account for the zero? If our counter said 2, we want the second number. Since 0 is technically letter #1, we can’t get letter #0 if the counter is set to 0, so that is why we add +1. [7]


Correcting

The whole setup for trigger two is seen in the image below. Change anything you missed here.


Step 4

Place a third and final trigger. This trigger should trigger when receiving on triggerSetup2.


Step 5

Create a new block coding section in this trigger-- as always, set up these variables first.

image


Step 6

Place a new if statement below the variables. Read step 3 for an explanation because it’s the same thing, just another digit.


Step 7


Corrections

After completing steps 4-7, you should be lead to this image.


Part 3 of 3:

Part three shows how to set up the counter and text to show answers and what-not.

Step 1

Place a counter. It incriments when receiving on increase and decreases on decrease. Set the counter to update the property, counter. Put overlays on the left and right corner of your screen that transmit on increase or decrease when you click them.


Step 2

Place a new text block. Create a new block code section that runs on updateText. Set the text to the property, selectedAlphabet.

image


Step 3

Place yet another text block, run code inside when receiving on updateText to shot the first input. It should get the first two numbers/letters of the property inputOverall.


Step 4

Do the exact same as step three, but this time it needs to get the last two numbers of the property to represent the second input.


Step 5

Place down a new text device. This time, it runs the block when receiving on updateAnswer. Fetch the property answer to display the answer.

image


Step 6

After completing part three, you should have something that looks like this. The debug numbers are for testing, but you can see the base, first and second inputs, and the answer. You can always change the appearance of the text like I did.


Exit

This should be finished! If you understand how it works, good for you! Now, you may be asking, slim, how is this gonna help me? If you are making something like my randomly generated maze guide, then it relies solely on one-digit numbers. Creating higher bases solves this problem.

I am so excited to publish this guide so lets get to it.


polls

Did this guide sum up laughs and multiply the fun?
  • My calculator couldn’t stop adding to the conversation.
  • You tried to make a math pun, but my laughter didn’t add up.
  • I prefer to use my calmulator for tricky problems.
  • My calculator went to therapy because it had too many unresolved issues.
  • does this guy ever quit with his jokes ._.
0 voters
In all seriousness, help me decide the difficulty.
  • 1/10
  • 2/10
  • 3/10
  • 4/10
  • 5/10
  • 6/10
  • 7/10
  • 8/10
  • 9/10
  • 10/10
0 voters
Did I do a good job explaining?
  • Yes!
  • No!
0 voters

After hours of hard work and dedication, I really hope you enjoyed this guide.

Remember to stay positive!


  1. Here is a full list of base 5 until we reach three digits: 0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 100. ↩︎

  2. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a ↩︎

  3. 0123456789a ↩︎

  4. Besides 0; I’ll get to that in a bit. ↩︎

  5. +1, accounting for the 0, ↩︎

  6. Again, you can always rename properties/variables. ↩︎

  7. :sparkles: the more you know :sparkles: ↩︎

10 Likes

My bro seriosly posted this at 4 AM :skull:

Anyway, nice guide, my brain is dumb enough to understand

4 Likes

wow.
this is nice, I’ve been using blackhole’s calculator for quite a while now.

1 Like

I love the format of this guide

The amount of puns in the polls is crazy. I’m gonna start calling you pun slim /j

2 Likes

Calculator puns are the best. It’s going to COSt you. /j

6 Likes

You should change difficulty polls to Number Rating Polls.

1 Like

I’m going to put the difficulty square once I get enough votes. I’m not sure when that is though. Or maybe not I have no idea what the future holds.

Besides, you can’t change a poll after the first 5 minutes anyway.

It’s the latter.

1 Like

10/10 , great guide

no way this came out at 4 in the morning lol

1 Like

I think thats because of the different time zones
or bro is really determined

ummm spelling mistake

2 Likes

Woah dont go on a math joke tangent here

7 Likes

Dude, first of all 10 out of 10. Another great guide added to the mix. Also…

This is the reason I gave up on algebra, I got tired of finding it’s ‘x’. I eventually told them she’s gone and ain’t coming back.

3 Likes

Nice This guide has a lot of value

3 Likes

Fire guide Slim.
I tried to tell him a joke, but when I asked my calculator for one it gave me a negative answer.
The best part is the excellent formatting for sure, in all seriousness. Anyways.

I’d say the difficulty is at least a five and could be up to an eight, if we’re thinking about how skilled the average user is.

6 Likes

Yeah, I mean it’s a toss-up. If we are talking to more experienced players, then I would say 6 or 7. For newer users to GKC, it’s prob an 8 or 9. I’d take the latter at that point.

1 Like

I think a solid eight is probably good. The difficulty poll is all over the place so…

1 Like

I think this was mentioned in some post, but we should vote based on how the average user would. We don’t want all the experienced people putting in 3’s and 2’s and having a new user go through a Brain seizure when they see this because it was put as 4/10.

3 Likes

Yeah that was a discussion '83 and I had somewhere recently. Vote not for yourself but for the average user when it’s a ranked poll and not an average poll- really average polls are better for difficulty but they can’t prevent trolling, I think.

2 Likes

okay is 7 or 6 ok? then

I wouldn’t know too much. But hopefully yes. But don’t rely on me, what do I know? I’m just a dragon.

frfr
Though this is awesome!
I didn’t get a chance to respond last night, but now I can.
While we’re going with number puns…
I, for one, like Roman Numerals.
Don’t ask where I got that, or why…

1 Like