Black Hole Math :D

Come talk about the game, your Contraptions, and your solutions!

Black Hole Math :D

Postby marjo on Sat Feb 15, 2014 7:50 pm

Hey there! For those of you who are willing to stomach a little bit of math, let's explore black holes....
Ok, so the black hole glitch, as you may or may not know, is triggered by a high number of overlapping rods, so before we can do any math, lets define what we mean by an overlap:
An overlap, o, is an intersection of two different rods, or two different rods connected at a joint

Another important thing to note is that any two given rods can define at most one o.

Now we can solve some problems.

Problem
Given a stack of n rods connected at a single joint (commonly known as a weight, or a neutrino rod), what is o?

To solve this problem, let's start from the bottom, and work our way up.
When we have only one rod (n=1), we know that o=0.
With two rods, o=1.
With three rods, we gotta remember that each rod "handshakes" each other rod, so o=3.
With four rods it gets interesting, and n=6.
If we made a chart, it would look like this:
n | o
1 | 0
2 | 1
3 | 3
4 | 6
5 | 10
6 | 15
...

I'm not gonna offer a proof, but we can see from the table (and if we keep going on, the pattern continues), is that each value of o goes up by n-1 each time.
So, the recursive definition of o as a function of n is as follows:
f(n) = (n-1) + f(n-1)
where f(1) = 0

But wait, we still haven't answered the problem, and we're already getting bored, so let's go back to what we're trying to accomplish.
Take any value of n, such as 50... what is o?
Look, we obviously have a problem, as our recursive definition is as good as a potato for figuring out the answer (potatoes taste good, but can't do math), because starting at 50 and going back and back until 1 takes a long time. Sure, it's fun and easy to get a computer to do, and a quick run of the program
Code: Select all
print (overlaps(50));

function overlaps(x) {
    if (x == 1) {
        return 0;
    }
    else {
        return x - 1 + overlaps(x - 1);
    }
}


gives us 1225 as an answer, but if we want to do this by hand, we need an iterative way of dealing with the problem.
Ok, again, I'm not going into exactly how we derive this, but n choose 2 gives us the equation:
n * (n-1)
2!
or simply:
n * (n-1)
2

(* is the multiplying operator)
This makes sense, because 50 times 49 divided by 2 is... 1225 :smile: .
The final function is:
f(n) = n * (n-1) / 2
So, now that we've got this equation, we have solved the first problem.

Problem
What is the minimum o required for the Black Hole Glitch to trigger? (This problem is assuming that this value is constant throughout every design/situation. We'll test this later.)

The first thing to do is find out how many rods are required to trigger the glitch in the simplest case, where there is one weight of sticks connected at a single joint. The lowest amount of rods happens to be 65 (no matter which kind of rod is used), so now it is quite trivial to find out o.
Either one of our algorithms will give us the answer of 2080.

The Road Ahead
Now that we know what o is required to trigger a black hole for a single weight, we can do some tests to see if this is consistent throughout any design.
A weight of 32 and a weight of 33 which overlap trigger the glitch. Deleting one rod stops it from triggering.
Two weights of 45 rods, one of 10, one of 4, and one of 3 (the total o of these weights is 2080) also triggers the glitch, but does not appear to be the least amount of rods that does in that configuration... anyone knows why? Perhaps it's something from the Note section at the bottom of the page.

Applications
Ah, so what can we do with this information? Perhaps someone with the API could find the average o of designs on levels with given difficulty and workshop size, so that we could make Black Hole resistant levels? I don't know, but I'm sure something useful can come out of this.

Note
Static and dynamic objects and goal pieces also effect Black Holes... I was testing on a blank level without any objects except the workshop and goal area.
It seems that rods which are near each other but don't overlap also count as they overlap....

If anybody has any comments, or something that I made a mistake in, use that comment section down there.... :smile: Thanks!
Last edited by marjo on Sat Feb 15, 2014 10:22 pm, edited 1 time in total.
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm

Re: Black Hole Math :D

Postby marjo on Sat Feb 15, 2014 7:51 pm

Sorry guys for the other posts, I was using a special character that caused an error, all fixed now :).
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm

Re: Black Hole Math :D

Postby ken75 on Sat Feb 15, 2014 10:24 pm

I've always been very interested in the equation you showed... n(1-n)/2 is pretty cool because it's equal to the sum of natural numbers up to n, and it also models the triangle numbers. That's interesting that it also represents the number of possible overlaps with n number of sticks.

Also, the level pieces do effect black holes so make sure you didn't have any overlapping statics in the test level :p
[Edit] Oop didn't see the note section :doh:
User avatar
ken75
 
Posts: 402
Joined: Fri Jan 16, 2009 4:56 pm
Location: Currently stuck in the Shadow temple...

Re: Black Hole Math :D

Postby marjo on Sat Feb 15, 2014 10:28 pm

Yep, it's awesome and fun when equations and constants are useful in more than one situation :smile:.
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm

Re: Black Hole Math :D

Postby jeke on Mon Feb 24, 2014 10:33 pm

I noticed something odd about this glitch - rod length has an effect, too.

http://www.fantasticcontraption.com/?designId=12017206

As it stands, this (ineffectual) design does not trigger the black hole glitch.

Shift click + drag the upper left point of the wood rod stack - make the stack as long as you can, and hit start. it will trigger the glitch. stop it, shrink the stack back down again and click start. glitch gone...

In this example, it might not be the fact that the length is increased, but the fact that the stack crosses a second zero-width yellow static object when lengthening it, that triggers the glitch. Extending the stack in this example creates another set of intersections (1 yellow object X the number of wooden rods). That would explain why, on occasion, extending water rod stacks across a design (lengthening it) will seemingly trigger the glitch, all by itself - it's really that more intersections against a stack have taken place.

I seem to remember a design that would trigger the glitch just by lengthening a large stack, though, and yet not creating additional intersections in the process.
User avatar
jeke
 
Posts: 27
Joined: Tue Nov 04, 2008 3:33 pm

Re: Black Hole Math :D

Postby ken75 on Mon Feb 24, 2014 10:55 pm

http://www.fantasticcontraption.com/?designId=12017208 Nope, length actually does have an effect. Take this one and lengthen it as long as you can without crossing the other dynamic....it triggers the glitch the same way as in yours with no extra intersections...
User avatar
ken75
 
Posts: 402
Joined: Fri Jan 16, 2009 4:56 pm
Location: Currently stuck in the Shadow temple...

Re: Black Hole Math :D

Postby louie9999 on Wed Mar 19, 2014 1:28 am

The whole time i'm reading this i'm goin like...

"Uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"

XD
louie9999
 
Posts: 12
Joined: Thu Nov 21, 2013 4:41 pm

Re: Black Hole Math :D

Postby Pawel. on Thu Apr 24, 2014 1:05 pm

ken75 wrote:http://www.fantasticcontraption.com/?designId=12017208 Nope, length actually does have an effect. Take this one and lengthen it as long as you can without crossing the other dynamic....it triggers the glitch the same way as in yours with no extra intersections...

hmmm interesting...
Maybe because the gray circle(the one you move) touches the boundary of build area :build: and somehow also counts...

Also, ken's avatar:
k/e ~ sum(3, 12)
k/e ~ sum(1, 12) - 3 (since 1+2 = 3)
k/e ~ 12(12-1)/2 - 3 (using the n(n-1)/2 formula)
k/e ~ 66 - 3
k/e ~ 63

k ~ 63*e (Euler's constant)
k ~ 171.25 :D
User avatar
Pawel.
 
Posts: 160
Joined: Sat Sep 29, 2012 12:09 pm

Re: Black Hole Math :D

Postby Maximirobbes on Thu Apr 24, 2014 2:59 pm

To start off, I would like to comment on your method of finding the "handshakes" formula. I hate recursive formulas, so I think of the problem intuitively. If you have say, 5 people in a room and each person needs a handshake each other person, we can plot those handshakes on a grid as follows. (The letters represent people)

A ae ad ac ab
B be bd bc
C ce cd
D de
E
E D C B A

It is a 5x5 grid indeed. However, no matter what size it is done with, a triangle will be formed which takes up a little less than half the grid. So, if the grid is 5x5, (25) and the triangle takes up a little less than half of the grid, (12.5) then the fact that that triangle takes up 10 squares makes sense.

But how much "less than half the grid?"
Answer: 1/2 of the width of the square. :)
So, there were 10 initial squares taken up by the grid above, add half of five to that, and we get 12.5, which happens to be exactly half of 25.

So I prefer this equation: summation of 1 to n = (n^2)/2 - 1/2n
Or even simpler: y = (x^2 - x)/2
Sorry to be that guy who shows to another useless way to do something in math, but perhaps you found it fascinating.

Two weights of 45 rods, one of 10, one of 4, and one of 3 (the total o of these weights is 2080) also triggers the glitch, but does not appear to be the least amount of rods that does in that configuration... anyone knows why? Perhaps it's something from the Note section at the bottom of the page.

If the "intersection limit" was reached at 65 rods, that does not necessarily mean the magical intersection number is 2080. Perhaps in this 45-10-4-3 instance, the reason you could trigger the glitch with less rods than that, with say a 45-10-4-2 configuration is because the magical intersection number is probably not actually 2080, but a number between 2080 and 2016. Perhaps when I get bored I can pinpoint it for you.

One question, when you were testing the 65 rod thing were you using the simple, small rods that automatically appear when you click, or did you stretch them out? I still have no idea why rod length would affect this, but perhaps I can pinpoint how much this affects things after I pinpoint the intersection number.
Last edited by Maximirobbes on Thu Apr 24, 2014 4:51 pm, edited 1 time in total.
Maximirobbes
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 pm
Location: The Murican West

Re: Black Hole Math :D

Postby marjo on Thu Apr 24, 2014 4:12 pm

Thanks for the comments -- You could be right that the number is not 2080, to test this we would need to put a lot of single rods around, I think. Cool math by the way, yeah recursivness is tricky.
I don't remember what length I used, but what I do know is objects don't have to be overlapping exactly. I think it's possible that object may have some sort of box around them, that may even extend infinitely in some directions, so when lengthening the rods you may be crossing some of these boxes.
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm

Re: Black Hole Math :D

Postby ken75 on Thu Apr 24, 2014 4:15 pm

Hold on. Macksim, are you saying that:

y = (x^2 + x)/2

and

(n * (n-1)) /2


are different?
User avatar
ken75
 
Posts: 402
Joined: Fri Jan 16, 2009 4:56 pm
Location: Currently stuck in the Shadow temple...

Re: Black Hole Math :D

Postby Maximirobbes on Thu Apr 24, 2014 4:54 pm

ken75 wrote:Hold on. Macksim, are you saying that:

y = (x^2 + x)/2

and

(n * (n-1)) /2


are different?

Oops.
Hehe I got excited and put a little + instead of a -.
Now it is correct. :oops:

But yeah they are them same thing really, I just arrived there in a different way.
Maximirobbes
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 pm
Location: The Murican West

Re: Black Hole Math :D

Postby ken75 on Thu Apr 24, 2014 5:29 pm

Oh. I didn't notice that the sign was wrong. But yeah they're the same thinggg
User avatar
ken75
 
Posts: 402
Joined: Fri Jan 16, 2009 4:56 pm
Location: Currently stuck in the Shadow temple...

Re: Black Hole Math :D

Postby Maximirobbes on Thu Apr 24, 2014 5:37 pm

ken75 wrote:Oh. I didn't notice that the sign was wrong. But yeah they're the same thinggg

So now apparently I am Macksim? Or do you only call me that when I do something ridiculous...

Edit: me, marjo, and airbear are in chat right now. You should join us.
Maximirobbes
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 pm
Location: The Murican West

Re: Black Hole Math :D

Postby ken75 on Thu Apr 24, 2014 9:27 pm

Oh.... I accidentally added a C. I meant Maksim. And sorry, I was at work then. On break.
User avatar
ken75
 
Posts: 402
Joined: Fri Jan 16, 2009 4:56 pm
Location: Currently stuck in the Shadow temple...

Re: Black Hole Math :D

Postby Maximirobbes on Fri Apr 25, 2014 4:18 pm

Ok so I've gone out and done some experimentation. It turns out the number when black holes start is not 2080 intersections, but actually 2021, I think. I did the experimentation of Mission to Mars, because I don't have access to a completely blank level, but that is close.

First, I used a simple 64 rod stack to experiment with.
http://www.fantasticcontraption.com/des ... d=12039305

After some experimenting, I found that a
64 rod stack (2016 intersections)
+ a 4 rod stack (6 intersections)
+ a 2 rod stack (1 intersection)
did not cause the black hole. That is 2021 intersections.
http://www.fantasticcontraption.com/?designId=12039327
Then Something Very Strange Happens...
Now try adding just one more intersection, to get 2022. We get what I call a "freeze hole."
http://www.fantasticcontraption.com/?designId=12039331
That is a 64+4+1+1 configuration, in case you are wondering.
In the freeze hole, once you press start/press space, you can't do anything, and nothing happens. Everything just floats there stupidly and the only was to escape is press back.
Then Something Even Stranger Happens!
If and only if you have precisely 2027 intersections, you get the rare half black hole! This configuration is 2016+10+1
http://www.fantasticcontraption.com/?designId=12039333
In the half black hole, it only has two of the four features of the regular black hole. When you hit start, all the joints disconnect and the build box becomes a slippery enclosure. However, no pieces float in the air like a regular black hole and when you press stop, you will not be able to move things outside the build box.

Once you get 2028 intersections or more (it is possible to get up to 7140, from pieces alone) you have the classic black hole in which some pieces float in the air, joints disconnect, the build box becomes a slippery enclosure, and you can move any pieces outside the box.

We are still rather clueless as to why extending a joint in a certain way causes the black hole glitch, it kind of undermines everything I just typed. It may have something to do with mass, and marjo has a theory that rods have invisible boxes around them that extend into space forever. I have also found that adding a simple rod not connected to anything can trigger one of the black holes even though it doesn't even remotely intersect or touch anything. Oh, we need to do more research.
Maximirobbes
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 pm
Location: The Murican West

Re: Black Hole Math :D

Postby marjo on Fri Apr 25, 2014 4:23 pm

Nice experiments, interesting how one rod can add an intersection.... Also, there are two types of black holes. One where you can fix it by pressing start again, and the other you need to click in the build area... I dunno :P
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm

Re: Black Hole Math :D

Postby Maximirobbes on Fri Apr 25, 2014 4:50 pm

marjo wrote:Also, there are two types of black holes.

Did you mean
Also, there are two other types of black holes.
?
Can you give me any examples of those for free levels?
Maximirobbes
 
Posts: 19
Joined: Thu Mar 06, 2014 4:12 pm
Location: The Murican West

Re: Black Hole Math :D

Postby marjo on Sat Apr 26, 2014 6:57 pm

One where you can fix it by pressing start again, and the other you need to click in the build area
User avatar
marjo
 
Posts: 372
Joined: Sun Oct 12, 2008 3:56 pm


Return to Levels and Game Chat



Who is online

Users browsing this forum: No registered users