Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Often things ARE as bad as they seem!


interests / rec.games.roguelike.nethack / Source code / algorithm question - generation of mines level

SubjectAuthor
o Source code / algorithm question - generation of mines levelJanis Papanagnou

1
Source code / algorithm question - generation of mines level

<thqh26$3v3l2$1@dont-email.me>

  copy mid

https://news.novabbs.org/interests/article-flat.php?id=2783&group=rec.games.roguelike.nethack#2783

  copy link   Newsgroups: rec.games.roguelike.nethack
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: rec.games.roguelike.nethack
Subject: Source code / algorithm question - generation of mines level
Date: Sat, 8 Oct 2022 02:42:46 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <thqh26$3v3l2$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 8 Oct 2022 00:42:46 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9212830af70ebfd4984d4983f64f010e";
logging-data="4165282"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kJpS2F7Xj1FScTZJL+kJI"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:dgYyc9vhAziK9YRyeUaZsTVHZ5c=
X-Enigmail-Draft-Status: N1110
X-Mozilla-News-Host: news://news.eternal-september.org:119
 by: Janis Papanagnou - Sat, 8 Oct 2022 00:42 UTC

Maybe a too specific question for this newsgroup? - Anyway, I try...

I've inspected the mines levels generation in the source code, here
specifically function pass_one() in file mkmap.c, where the random
initialized level data is algorithmically manipulated (in sort of a
Conway's "Game of Life" manner); the random map data is sequentially
iterated and for each (x,y) element all adjacent neighbors are
counted to determine the new status of the actual (x,y) element.
The element test (get'ter) and the change (set'ter) functions work
both on the same levl[] array; that means that while iterating on
the array data is partly taken from the unchanged original random
elements and partly from elements already changed, so this results
in an asymmetric behavior of the algorithm. I wonder whether that
is intentional or an oversight. (Of course we can always say that
if the result looks fine we don't have to care. I'm curious anyway.)
Since there's no reference in the code where the algorithms stems
from it's hard to judge. Anyone out there (Pat?) who remembers these
details?

BTW, function pass_two() in the same file works - as I've expected
for pass_one() as well - on a temporary new_loc[].

PS: This part of the algorithm/code seems to be quite old; it can
be found in Slashem and NH-343 as well.

Janis

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor