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

**URL:** https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483
**Category:** Coding Questions
**Created:** [November 14, 2019, 10:30am UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483 "2019-11-14T10:30:45Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 2:18pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/21 "2019-11-16T14:18:23Z")

</div>

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!

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/67962e876e73b4522c16a572645a1190f87870b7.png)

Should I post code?

🙂

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [November 16, 2019, 2:39pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/22 "2019-11-16T14:39:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 2:53pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/23 "2019-11-16T14:53:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 2:57pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/24 "2019-11-16T14:57:39Z")

</div>

My morning programming exercise inspired by @paulstgeorge

```auto
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);
  }

```

[![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/67962e876e73b4522c16a572645a1190f87870b7.png) ](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/67962e876e73b4522c16a572645a1190f87870b7.png)  
🙂

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 3:53pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/25 "2019-11-16T15:53:33Z")

</div>

@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:

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

```

Let’s try this next:

[![](https://upload.wikimedia.org/wikipedia/commons/d/d2/Circularmazeexample.jpg) ](https://upload.wikimedia.org/wikipedia/commons/d/d2/Circularmazeexample.jpg)

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

🙂

References:  
[https://processing.org/reference/randomSeed\_.html](https://processing.org/reference/randomSeed_.html)

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 3:57pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/26 "2019-11-16T15:57:52Z")

</div>

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.

🙂

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [November 16, 2019, 4:01pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/27 "2019-11-16T16:01:45Z")

</div>

> [@glv](#):
>
> I got started on the simple one with lines

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

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 5:34pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/28 "2019-11-16T17:34:39Z")

</div>

By changing two lines of your code

```auto
    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.

 ![08](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c84170ab0a8a4abdd8717a6c65e67e2f400f6e1c.png)

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 5:40pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/29 "2019-11-16T17:40:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [November 16, 2019, 6:00pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/30 "2019-11-16T18:00:51Z")

</div>

Solved!

![20191116_145956](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ee746b1c5c50a888f97438564a8f6e0a1dbc8bcc.gif)

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 7:02pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/31 "2019-11-16T19:02:15Z")

</div>

Brilliant! Code please. Looking forward to seeing it.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [November 16, 2019, 7:11pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/32 "2019-11-16T19:11:20Z")

</div>

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

> **[Perplexus Epic - 3D marble maze puzzle](http://blog.dugnorth.com/2011/07/perplexus-epic-3d-marble-maze-puzzle.html?m=1)**
>
> Back in October of 2009, I posted about three spherical labyrinth puzzles . The idea with these toys is to flip, twist, and spin the sphere...

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 7:32pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/34 "2019-11-16T19:32:22Z")

</div>

> [@Chrisir](#):
>
> Why is nobody going 3D though?

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:

> [@paulstgeorge](#):
>
> 10 PRINT CHR$(205.5+RND(1)); : GOTO 10

to 3D mazes.

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

Please.

🙂

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 8:31pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/35 "2019-11-16T20:31:50Z")

</div>

@glv You know those radar screens:

 ![03](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/c81e7d76807dd1579daf23631936a646767462ae.png)

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?

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 8:43pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/36 "2019-11-16T20:43:19Z")

</div>

@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](https://youtu.be/RTZvgVu4LeU?t=11)

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!

🙂

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 16, 2019, 8:47pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/37 "2019-11-16T20:47:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [November 16, 2019, 9:01pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/38 "2019-11-16T21:01:59Z")

</div>

I solved the maze too!

I wrote code to:

1. display image from [maze](https://upload.wikimedia.org/wikipedia/commons/d/d2/Circularmazeexample.jpg)
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

 ![Capture%20red](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7442fa5dcc7e74eadd6d065ee5b1f2cb5bdc2059.png) ![Capture%20Green](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3b101c541c1ac985b3b797947e6fdc57e297378b.png)

Later I will trace through path slowly…

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

That was fun!

🙂

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [November 16, 2019, 9:54pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/39 "2019-11-16T21:54:35Z")

</div>

> [@paulstgeorge](#):
>
> Don’t get me started on gears!

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

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 17, 2019, 3:18pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/40 "2019-11-17T15:18:32Z")

</div>

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

```auto
/*
 * 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() {
}

```

---

<div class="post-metadata">

### Author: ![paulstgeorge](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@paulstgeorge](https://discourse.processing.org/u/paulstgeorge)
#### Post date: [November 17, 2019, 3:19pm UTC](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483/41 "2019-11-17T15:19:32Z")

</div>

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

[Previous page](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483.md?page=1)

[Next page](https://discourse.processing.org/t/10-print-chr-205-5-rnd-1-goto-10/15483.md?page=3)
