# Topic: More than N Dimensions (Page 1 of 1)

warjournal

From:
Insane since: Aug 2000

posted 02-12-2016 18:34

This is just the basic algorithm for a directed graph mapping system. I do have this coded in Python. I've also cobbled together some quick-n-dirty PyGame for graphics, but very in-efficient cobbling. Basically, I learned just enough PyGame to get the graphics working.

We start with two planes that are connected at two corners and we index them. Notice that the indexing starts at 1 and not 0. There is a reason for the oddball indexing that should become apparent as we move along. Two indexed planes and they are connected at two points.

code:
```+ - - - - - + - - - - - +
|           |           |
|           |           |
|     1     |     2     |
|           |           |
|           |           |
+ - - - - - + - - - - - +```

Now we index the corners and seperate them. The indexing for the corners is arbitrary and can start at 0 if you want. I just started with 1 just because.

code:
```1 - - - - - 2    2 - - - - - 3
|           |    |           |
|           |    |           |
|     1     |    |     2     |
|           |    |           |
|           |    |           |
4 - - - - - 5    5 - - - - - 6```

Now, the outside edges are going to be data buffers of a sort. All four outside edges and the corners hold the connection data. As such, the inside part has to blocked with walls (as currently denoted with #).

code:
```1 0 0 0 0 0 2    2 0 0 0 0 0 3
0 # # # # # 0    0 # # # # # 0
0 #       # 0    0 #       # 0
0 #   1   # 0    0 #   2   # 0
0 #       # 0    0 #       # 0
0 # # # # # 0    0 # # # # # 0
4 0 0 0 0 0 5    5 0 0 0 0 0 6```

Open up a space in each as a walk-through from one plane to the other.

code:
```1 0 0 0 0 0 2    2 0 0 0 0 0 3
0 # # # # # 0    0 # # # # # 0
0 #       # 0    0 #       # 0
0 #   1     0    0     2   # 0
0 #       # 0    0 #       # 0
0 # # # # # 0    0 # # # # # 0
4 0 0 0 0 0 5    5 0 0 0 0 0 6```

When walked through, could use the corner data to know what to do, but that isn't good enough for an n dimensional system. That is, more than two planes could share the exact same corners, so a little bit more data has to be in the system. That extra bit of data is going to be the negative index of the plane to move to. When you step onto a negative number, that is how you know to move to the positive index plane.

code:
```1 0 0 0 0 0 2    2 0 0 0 0 0 3
0 # # # # # 0    0 # # # # # 0
0 #       # 0    0 #       # 0
0 #   1    -2   -1     2   # 0
0 #       # 0    0 #       # 0
0 # # # # # 0    0 # # # # # 0
4 0 0 0 0 0 5    5 0 0 0 0 0 6```

When running around plane 1, you walk onto -2 at the data buffer edge. The fact that -2 is negative means to move to next plane. Then, -2*-1 means move to plane 2. That's when the corner indices kick in for orientation. And, this is why the indices for the planes doesn't start at zero. You know, because -0.

This whole thing means that you can connect in all sorts of ways. Look at the way planes 2 and 3 are connected.

code:
```1 0 0 0 0 0 2    2 0 0 0 0 0 3    8 0 0 0 0 0 6
0 # # # # # 0    0 # # # # # 0    0 # # # # # 0
0 #       # 0    0 #       # 0    0 #       # 0
0 #   1    -2   -1     2    -3    0 #   3    -2
0 #       # 0    0 #       # 0    0 #       # 0
0 # # # # # 0    0 # # # # # 0    0 # # # # # 0
4 0 0 0 0 0 5    5 0 0 0 0 0 6    7 0 0 0 0 0 3```

When you walk from plane 2 to plane 3, you use the corners to orient and re-arrange the map data for the plane being walked to.

Here's one that will bake your brain:

code:
```1 0 0 0 0 0 2    5 0 0 0 0 0 2    8 0 0 0 0 0 2
0 # # # # # 0    0 # # # # # 0    0 # # # # # 0
0 #        -2    0 #        -1    0 #       # 0
0 #   1   # 0    0 #   2    -3    0 #   3    -2
0 #        -3    0 #       # 0    0 #        -1
0 # # # # # 0    0 # # # # # 0    0 # # # # # 0
4 0 0 0 0 0 3    6 0 0 0 0 0 3    7 0 0 0 0 0 3```

That is a basic example of more than two planes connected along the same edge (sharing two corners).

One of the fun things is that the data for the next plane is re-oriented so that the corners match. This means that everything remains relative. Walking around the surface of a 3d cube can be disorienting if you don't have the visual in your brain. Three right turns on a cube can throw you for a loop if you don't know what's going on.

I started this project because I wanted to walk around in a hypercube in 4d. This absolutely does do a 4d hypercube. As I got to thinking about it, it can do n dimensions. As a matter of fact, you can throw dimensions right out the window and connect planes in all sorts of willy-nilly ways. Well, as long as your map data is well crafted.

I came up with this algorithm and coded it all on my own. Sitting under my rock and tapping away like the happy little code monkey that I am. Once I got this running to my satisfaction, I started drawing up maps, connecting things, and having a blast doing so. But I got to looking at some of my maps and my brain got tickled. Even though this was something that I had come up with on my own, there was something familiar about it. That map that I just drew... I know I've seen that structure before. So I started poking around the interwebs using various search terms. Turns out I had created a directed graph system. Now I know what to call it so other folks will know what I mean. While it is nice to have a formal name, but I was looking forward to calling it My More Than n-Dimensional Mapping System.

More than n dimensions.
Come on, that's funny.
Kekeke.

Once I get further along, I'll probably serve it up with some example maps. Or pass it to somebody else to serve.

(Edited by warjournal on 02-12-2016 18:35)

(Edited by warjournal on 02-12-2016 18:38)