10 print chr$(205.5+rnd(1)); : goto 10

Thank you for the inspiration to do this!

Your template for arcs and pairing made it easy to start on this.

I selected the correct pairs of arcs with a random() and used my arcDraw() to to draw arcs in a simple loop as before.

I did not really need the arcDraw() but it did kick start the process and made for cleaner code with less chance of errors.

And voila!

Should I post code?

:slight_smile:

3 Likes

Do you also have a function to calculate shortest path from one side to the other?

1 Like

Wow, that is nice. Yes @glv please do post the code. I’m looking forward to seeing it.

2 Likes

My morning programming exercise inspired by @paulstgeorge

int sp = 30;
int y;
int x;

int[] z = { -1, -1, +1, -1, +1, +1, -1, +1};

void setup() 
  {
  size(600, 600);
  noFill();
  stroke(255, 255, 0);
  strokeWeight(2);
  background(0);
  x = sp/2;
  y = sp/2;
  }

void draw() 
  {
  if (y<height) 
    {
    int r=int(random(2));
    println(r);
    if (r%2 == 0) 
      {
      arcDraw1(1, x, y, sp);
      arcDraw1(3, x, y, sp);
      } 
    else
      {
      arcDraw1(0, x, y, sp);
      arcDraw1(2, x, y, sp);
      }      
    x+=sp;
    if (x>width) 
      {
      y+=sp;
      x=sp/2;
      }
    }
  }

void arcDraw1(int a, int originX, int originY, int sp)
  {
  arc(originX+z[2*a]*sp/2, originY+z[2*a+1]*sp/2, sp, sp, a*TAU/4, (a+1)*TAU/4);
  }


:slight_smile:

2 Likes

@paulstgeorge

We had so much fun with these!

I now use this to keep track of a cool maze so I can reproduce it with a know seed:

  seed = int(random(1000));
  randomSeed(seed);
  println(seed);

Let’s try this next:

I will not look at other code until I have done this! Not today or anytime soon though…

:slight_smile:

References:
https://processing.org/reference/randomSeed_.html

3 Likes

Hello @noel

Tracing through the paths and filling them is on my “to do” fun programming list for a rainy day.
Shortest path between two ends will follow…

I got started on the simple one with lines; the arcs may present a challenge.

:slight_smile:

That was what I was thinking about also.
I was reading this.
https://www.techiedelight.com/find-shortest-path-in-maze/

By changing two lines of your code

    int r=int(random(20));
    println(r);
    if (r <= 12)

one can skew the probabilities of one or the other tile. With a threshold of 0.6 (for example), there are many more long sequences.

2 Likes

What do you see as the ‘tile’? Is it nine concentric circles broken into arcs that can be off or one, and radial lines treated the same way?

@glv

Solved!

20191116_145956

4 Likes

Brilliant! Code please. Looking forward to seeing it.

Heck! This thread is so cool!
Why is nobody going 3D though?

4 Likes

I am enjoying this topic and creating 2D mazes that are simple and elegant; this is new for me and engaging.

It is quite the leap from:

to 3D mazes.

Can we please keep this topic focused on 2D mazes and enjoy the simplicity of that for now?

Please.

:slight_smile:

@glv You know those radar screens:

so, if you have a radial line (from that goes from the centre of the circle to the circumference) and that line sweeps through 2*PI. The line is made from segments that can be yellow or black. Sometimes, some of the pixels in the line can leave a trace. Could this work?

@paulstgeorge

I created some gears a while back with PVectors to “tile” the gear shapes, lines and vertices and trying that approach.

This is my gear video at the spot where I drew individual gears:
Gear Building

The circular maze is my quick and very rough first pass at this; it will look better once I get around to it.

I am going to try this from scratch; that is how I like to code these days.

Keep the ideas coming! But I will not look at any finished code for now.

Still thinking about the tiling…

And again… thanks for this topic!

:slight_smile:

Don’t get me started on gears!
http://www.paulstgeorge.com/travelling-curves/

2 Likes

I solved the maze too!

I wrote code to:

  1. display image from maze
  2. draw my progress in red with lines as I mousePressed() my path
  3. logged mouse location in an array from each mousePress() and store in an array
  4. redraw my path in green with a keyPress

Later I will trace through path slowly…

I could have printed it but wanted to be environmentally friendly.

That was fun!

:slight_smile:

2 Likes

I actually designed these cogwheels for linear sawing machines. Slow forward working movement, and fast retrieve.

2 Likes

Would you adam and eve it? Look what I found on Sketchpad. It is by Keith O’Hara.

/*
 * 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10
 * http://www.slate.com/articles/technology/books/2012/11/computer_programming_10_print_chr_205_5_rnd_1_goto_10_from_mit_press_reviewed.html
 * Keith O'Hara <kohara@bard.edu>
 * Dec 2012
 *
 */
 
//c64 pallete colors from 
// http://www.blitzbasic.com/Community/posts.php?topic=52312
 
color[] c64 = {
  #FFFFFF, #744335, #7CACBA, 
  #7B4890, #64974F, #403285, #BFCD7A, 
  #7B5B2F, #4f4500, #a37265, #505050, 
  #787878, #a4d78e, #786abd, #9f9f9f
};
 
void setup() {
  size(640, 480);
  strokeWeight(5);
  mouseMoved();
}
 
void mouseMoved() {
  background(0);
  int c = int(map(mouseX, 0, width, 10, 50));
  int i = int(map(mouseY, 0, width, 0, c64.length));
  stroke(c64[i]);
  for (int x = 0; x < width; x += c) {
    for (int y = 0; y < height; y += c) { 
      if (random(1) < .5) {
        line(x + 2, y + 2, x + c - 2, y + c - 2);
      }
      else {
        line(x + 2, y + c - 2, x + c - 2, y + 2);
      }
    }
  }
}
 
void draw() {
}
2 Likes

I think you view it on
http://studio.processingtogether.com/sp/pad/iframe/ro.98U8jOf0mug8C/rev.2

2 Likes