http://tinyurl.com/4c9zyj
http://tinyurl.com/3h2j5h
The algorithm operates on a rectangular grid; I think it can be easily
generalized to hexagons or other regular grids. It starts with an
initial seed of some dug-out cells, with their diggable neighbours in
store. The main loop: Get a random diggable cell from the store; if it
has between n_min and n_max dug-out neighbours, and digging it won't
connect previously unconnected cells, dig it out and store its diggable
neighbours. Repeat until reaching the desired number of cells, or no
more cells are found in the store.
The resulting patterns are "seed-centric". Because of the "no new
connections" condition, if the seed contains no loops neither does
the finished pattern. If loops are desired this condition can of
course be ignored with some chosen probability. There are many
pairs of (n_min, n_max) that give interesting results, for example
(1, 1) makes a narrow maze without 90 degree turns, (1, 8) a cavern
with fractured edges, (3, 7) a cavern with somewhat smoother edges,
(2, 3) and (2, 4) a dendritic (brownian tree -like?) pattern, etc.
A C implementation:
http://tinyurl.com/3o8lzl
--
Kusigrosz To send mail, remove 'erase' from the address
You see here a scroll labeled "cV2NpPqIHnw"
Interesting, if not conventionally roguelike! The first could be a
insect nest of some sort, the second an underground storage room with
some walls...
- Gerry Quinn
--
Lair of the Demon Ape (a coffee-break roguelike)
<http://indigo.ie/~gerryq/lair/lair.htm>
Looks great. What license is it under? Public domain or GPL would be
ideal if possible.
Andrew
Looks great, you should also put some comments at the top the file,
author, licence, version etc.
So if I use it I can remember to give credit to you.
You have weird curly brace placement, I have never seen it like that
before :P
> You have weird curly brace placement, I have never seen it like that
> before :P
Not really, IMO - he moves braces a tab right to differentiate
functions; I don't do that myself, but it doesn't seem unclear in any
way.
- Gerry Quinn
Public domain.
Thanks - much appreciated for your contribution to the noosphere.
Andrew
I actually used to use that curly brace standard. It was a result of
learning C from Laser C,
http://www.atarimagazines.com/st-log/issue25/78_1_LASER_C.php
You can see a screen shot of some Laser C example code part way down
that review. The review is a bit of a blast from the past too.
--
Jeff Lait
(POWDER: http://www.zincland.com/powder)