0

I'm trying to build a small script to generate a random racing track that always connects to its start out of a fixed set of tiles.

Does anyone have any hint or know of any algorithms that can help me with this?

For better understanding:

  1. Give a number for available straight pieces
  2. Give a number for available curved pieces
  3. Generate a round course that always connects to its starting point without using more than the given tile numbers.
Peter O.
  • 32,158
  • 14
  • 82
  • 96
  • If you're only interested in straight sections and 90° bends, it would be easier to: start with a rectangle; select a side at random and replace the middle third with a U-shaped section; repeat until you have a pleasing result. This way you generate only valid race-tracks and avoid a lot of checking of connectivities (is there a valid track with 6 90° bends ? 5 ? *etc*). – High Performance Mark Dec 28 '19 at 18:47
  • Hmm thanks for your response. The project is for some learning so an complicated way is also welcome. :) For me the important part is the possibillity to say max X straights and max X curves. Any suggestions? (I like your aproach but i think its not siutable for my problem) – Christoph Kruppe Dec 28 '19 at 19:14
  • Also race Tracks should be possible that look like this: "-|-" so no cross section but an straight one Level and an straight an Level above. – Christoph Kruppe Dec 29 '19 at 10:46

0 Answers0