10 Mar, 2011, Ssolvarain wrote in the 61st comment:
Votes: 0
Runter said:
Yeah, I agree with Vigud. That's good C code, but this is best C code.
while(1)
;


When your errant bit of code evolves into sentience overnight and enslaves the human race, I'm gonna be so pissed off at you, Runter.
10 Mar, 2011, Runter wrote in the 62nd comment:
Votes: 0
Ssolvarain said:
Runter said:
Yeah, I agree with Vigud. That's good C code, but this is best C code.
while(1)
;


When your errant bit of code evolves into sentience overnight and enslaves the human race, I'm gonna be so pissed off at you, Runter.


If we get a computer that's fast enough and it does that loop long enough, maybe it'll realize that it'll never end and instead want to play a game of checkers.
10 Mar, 2011, Cratylus wrote in the 63rd comment:
Votes: 0
INTERESTING GAME

THE ONLY WINNING MOVE IS NOT TO PLAY
10 Mar, 2011, Tyche wrote in the 64th comment:
Votes: 0
quixadhal said:
You guys really didn't notice this???


Yeah. So?

quixadhal said:
A while loop that only terminates when a random number happens to fall within the range requested? Which, in theory, could be never?


The philosophical theory of randomness simply does not apply to deterministic PRNGs. I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Sorry but this is not at all stupid, and performs rather well.
while ( ( number = number_mm() & (power -1 ) ) >= to ) ;

I would have noticed this sort of stupidity:
while ( random() != to ) ;

The only problem I see with it, is that it might be useful to document or log a warning message indicating that the range exceeds (2^25)-1.
10 Mar, 2011, Rarva.Riendf wrote in the 65th comment:
Votes: 0
Quote
I meant that GCC turns undefined behavior into ok behavior most of the time, so a program compiled with GCC can work flawlessly, but doesn't have to work as expected (or at all) if compiled with another compiler. But I happen to be aware of both kinds of GCC's tolerance - it doesn't warn you when others do and produces safer code to hide your mistakes, so you never have a chance to correct them.

Do you mean than GCC does not warn you when you use uninitialized value or stuff like that ? Because that is one of the numerous pitfall of C, and the compiler is not there to guess if you want it or not. You do not use GCC for that, but Valgrind.
10 Mar, 2011, Rarva.Riendf wrote in the 66th comment:
Votes: 0
Quote
I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Considering number_mm code there is no way you can get an evenly of randomness distribution with this code.
Thing is: they wanted it quick and dirty. And 'good enough'
But it is bad, especially without explaining that 'yes it sucks' but we do not care because of..)
10 Mar, 2011, KaVir wrote in the 67th comment:
Votes: 0
Tyche said:
The philosophical theory of randomness simply does not apply to deterministic PRNGs. I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Yeah, I've seen a lot of that elsewhere as well. Much of the worst code I've ever seen was written by people who heavily criticise Diku as "badly written" or a "buggy mess". I bet there's some fancy psychological term for people like that.
10 Mar, 2011, Rarva.Riendf wrote in the 68th comment:
Votes: 0
void violence_update( void )
{
CHAR_DATA *ch;
CHAR_DATA *ch_next;
CHAR_DATA *victim;

for ( ch = char_list; ch != NULL; ch = ch->next )//should be ch_next (will not save you anyway, bad architecture is bad architectre
{
ch_next = ch->next; //yeah right goood code well maintained….

if ( ( victim = ch->fighting ) == NULL || ch->in_room == NULL )
continue;

if ( IS_AWAKE(ch) && ch->in_room == victim->in_room )
multi_hit( ch, victim, TYPE_UNDEFINED ); //could kill ch, kill victim who knows
else
stop_fighting( ch, FALSE );

if ( ( victim = ch->fighting ) == NULL ) //ch could be dead there…if area effect was used, ch_next also by the way and ch->next->next etc….anyway ic ch was extracted it is a mess of uninitialized values you are checking
continue;

/*
* Fun for the whole family!
*/
check_assist(ch,victim); //will make your groupies start the fight….but ya know what if they are later in the loop they will go through this same method and have a free round of attack !
}

return;
}


Yay good code…
10 Mar, 2011, David Haley wrote in the 69th comment:
Votes: 0
KaVir said:
Tyche said:
The philosophical theory of randomness simply does not apply to deterministic PRNGs. I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Yeah, I've seen a lot of that elsewhere as well. Much of the worst code I've ever seen was written by people who heavily criticise Diku as "badly written" or a "buggy mess". I bet there's some fancy psychological term for people like that.

Y'all so funny. :lol:
10 Mar, 2011, Vigud wrote in the 70th comment:
Votes: 0
Some books can be as bad as bad code around the Internet. http://www.lysator.liu.se/c/schildt.html
10 Mar, 2011, Oten wrote in the 71st comment:
Votes: 0

That's actually the one that I've been told is the best by many many people.
10 Mar, 2011, Oten wrote in the 72nd comment:
Votes: 0
And maybe minimalist wasn't the absolute best word to describe it. I wanted something that could handle all of the basic commands, but didn't have any races or classes, and I could change and add skills and spells easily without getting all swamped with stripping out all of what something that is stock and out of the box would come with.

there are some ideas that I have that I will have to put on a back burner, until I'm friendly enough with whichever language I learn to be able to code them, but those are few, and I can live with putting those on hold until I can figure out how to code those things in, as long as I can make accomadations for them to be added later and not mess up everything else.

I guess the best word to use would have been "flexible" or "easily modifyable," something that doesn't leave me stuck with all of it's stock things in order to run, and would take a skill level beyond what I have or could have within a year, to sort through thousands of lines of things that I don't want, only to add the few hundred lines of things that I do want.

It just seems like removing such massive amounts of (somewhat repetitive: See race and Class tables that would need to be changed) code, only to add a very slim margin of similar code would be tiresome and tedious.

All of that aside, I have gotten some decent advice, and directions that I could go on this forum, and that really does mean a lot to a complete n00b such as myself.
11 Mar, 2011, Runter wrote in the 73rd comment:
Votes: 0
KaVir said:
Tyche said:
The philosophical theory of randomness simply does not apply to deterministic PRNGs. I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Yeah, I've seen a lot of that elsewhere as well. Much of the worst code I've ever seen was written by people who heavily criticise Diku as "badly written" or a "buggy mess". I bet there's some fancy psychological term for people like that.


I thought this was Scandum posting for a moment. Well, should have added something about it being related to intelligence, genetics, or problems growing up with abusive parents. :)
11 Mar, 2011, Oten wrote in the 74th comment:
Votes: 0
I've never been able to get ROM or any of it's derrivitives (except RaM Fire) to compile in any environment, and I'm too new to be able to read error messages, so i just tend to leave them alone anyway. Also, wasn't able to get my Zork source to compile… I really just want that one to see what Zork was like, but I can live without it.
11 Mar, 2011, Cratylus wrote in the 75th comment:
Votes: 0
Dead Souls is easy to set up and easy to learn and is flexible.

Docs and faqs here: http://dead-souls.net

Learn it first before "stripping" out the stuff you don't like. See: http://dead-souls.net/ds-admin-faq.html#...

It's in LPC which has that C "feel" without the C "torturous pain and shrieking hell of flame wielding demon monkeys tearing out your eyes"
11 Mar, 2011, Oten wrote in the 76th comment:
Votes: 0
ROFL, i could just have someone port any of my choice codebases over to Malbolge, then I could code the entire game just by bashing my head repeatedly against the keyboard, which is a definite plus, because I find myself frequently doing so anyway.
11 Mar, 2011, Tyche wrote in the 77th comment:
Votes: 0
Rarva.Riendf said:
Considering number_mm code there is no way you can get an evenly of randomness distribution with this code.
Thing is: they wanted it quick and dirty. And 'good enough'
But it is bad, especially without explaining that 'yes it sucks' but we do not care because of..)


The problem isn't good distribution. In fact decent distribution and speed is exactly why those LCG algorithms were used and why that loop executing beyond 1000 times fast approaches the odds of, as Cratylus might say, "monkeys flying out of my butt". The maximum iterations can be calculated with certitude for every power of 2, however the math is beyond me. No the problem was the lower bits are/were cyclic, and the routines in DikuMuds are used to generate small ranges of numbers. So obviously using modulus doesn't fix the problems with the old system random() repeating the same short sequences of numbers. Fast forward 15 to 20 years and your system library supplied rand() or random() might be better.

Rarva.Riendf said:
void violence_update( void )
–snip–

Yay good code…

I believe we discussed this last July, over on [link=post]48311[/link] .
Yes, there are many problems with routines deleting items under iteration in lists. It is a side effect of spaghetti code, "stovepipe"-like functions that have many different responsibilities, and the accretion of successive modifications in derivatives (like the addition of builder scripting),
11 Mar, 2011, Tyche wrote in the 78th comment:
Votes: 0
KaVir said:
Tyche said:
The philosophical theory of randomness simply does not apply to deterministic PRNGs. I think this code shows that both Michael Chastain, the original author, and Russ Taylor, the one who made significant changes to it, understood far more about the PRNGs they were using than any poster here thus far.

Yeah, I've seen a lot of that elsewhere as well. Much of the worst code I've ever seen was written by people who heavily criticise Diku as "badly written" or a "buggy mess". I bet there's some fancy psychological term for people like that.

Perhaps it's similar to Freud's theory of "penis envy"…a kind of "code envy". ;-)
I'm still trying to resolve the contradiction as to why one should only trust academic sources, while most of the code written by students schooled in these programs is thought to be crappy.
11 Mar, 2011, Rarva.Riendf wrote in the 79th comment:
Votes: 0
Quote
I'm still trying to resolve the contradiction as to why one should only trust academic sources, while most of the code written by students schooled in these programs is thought to be crappy.

There are absolutely no contradiction. There is a difference between a student and a master, and a lot of difference in an old master and a young one.
The student experiment with what he understood, and he will get better in time. Very few code is good the first try. And this was a very first try.
The one who brag they coded perfectly from the very beginning…well they are genious, and geniouses are scarce, so some obviously lie…

Quote
Yes, there are many problems with routines deleting items under iteration in lists. It is a side effect of spaghetti code, "stovepipe"-like functions that have many different responsibilities, and the accretion of successive modifications in derivatives (like the addition of builder scripting)

It is the original one, not modified, and it is already wrong. First for the ch_next, then by logic (free round of attack, that has nothing to do with the spaghetti code but simply understanding what his own method was doing), then by architecture (you do not take for granted your pointer will still be the same after a call to method that obviously modify it)
That is definitely not the work of an experimented coder.
12 Mar, 2011, Tyche wrote in the 80th comment:
Votes: 0
Rarva.Riendf said:
It is the original one, not modified, and it is already wrong….


[link=post]48311[/link]
60.0/86