|
![]() |
#1 |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
![]() |
strange C code in Angband (am I reading this right?)
This code is in the function to do polymorphing:
Code:
/* Allowable range of "levels" for resulting monster */ lev1 = r_ptr->level - ((randint(20)/randint(9))+1); lev2 = r_ptr->level + ((randint(20)/randint(9))+1); Why would the max range of the levels of the polymorphed monsters be a random thing instead of fixed? This strikes me as a very strange formula and I wonder how whoever programmed this came up with it. Am I reading this right? Does this strike anyone else as odd? ..just something I wondered about when I was looking at the code..
__________________
Will_Asher aka LibraryAdventurer My old variant DaJAngband: http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...) |
![]() |
![]() |
![]() |
#2 | |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 58
Posts: 9,532
Donated: $60
![]() ![]() |
Quote:
Where the exact 9 and 20 values came from I don't know - I guess someone originally calculated a good distribution to use.
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
|
![]() |
![]() |
![]() |
#3 |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 1,124
Donated: $10
![]() |
ah. now it makes a lot more sense.
reading the code is interesting..
__________________
Will_Asher aka LibraryAdventurer My old variant DaJAngband: http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...) |
![]() |
![]() |
![]() |
#4 | |
Adept
Join Date: Jun 2007
Location: North of England.
Posts: 211
![]() |
Quote:
EDIT - nice to see you haven't gotten bored with those sources yet, will_asher =)
__________________
You sold a Broken Sword (1d2) (-2,-4) {average} (j) for 1 gold. The shopkeeper howls in agony! You say "Dude, the clue is in the name...". |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Strange Isolated Room | z118 | AAR | 1 | February 4, 2008 23:38 |
Screensaver needs to rewrite some code | APWhite | Vanilla | 0 | October 16, 2007 21:19 |
Looking through the code | K.I.L.E.R | Vanilla | 5 | July 11, 2007 08:01 |
The safe_setuid code | CJNyfalt | Vanilla | 11 | June 26, 2007 03:25 |