Page 1 of 2

Random Character Generator in Bash

Posted: Mon Feb 20, 2012 12:38 pm
by pmjdebruijn
I wrote a simple (incomplete) random character generator for BFRPG in Bash (as in UNIX Shell). I'm quite aware this isn't the most ideal way to do it, but it enabled me to do it quickly.

You can download it here:
http://files.pcode.nl/basicfantasy/bfrpggen/bfrpggen.sh
It should work fine on any modern UNIX machine, with Bash 4 and later. Windows users would need Cygwin or something like that.

However, I do have a set of 512 sample generated characters here (as plaintext files):
http://files.pcode.nl/basicfantasy/bfrpggen/samples/

The character generator has some heuristics to avoid boring/uninteresting characters to an extent:
1. It avoids same value characteristics.
2. All characteristics should total between 54 and 72 (all 3's or all 4's), to avoid too weak or powerful characters.
3. Single hit point character are avoided (D4 is at least 2 HP, D6 is at least 3 HP, D8 is at least 4 HP).
4. These heuristics can sometimes lockup the script (endless re-roll loop), fairly easily solved, but I've been too lazy.

The distribution of generated characters is fairly nice (from a set of 512):

HUMAN 130
DWARF 147
ELF 108
HALFLING 126

FIGHTER 141
CLERIC 134
MAGICUSER 77
THIEF 159

Re: Random Character Generator in Bash

Posted: Mon Feb 20, 2012 1:27 pm
by wynteriii
UNIX?........So many memories come to mind. It also brings up Ubuntu which brings up so many nightmares.

Re: Random Character Generator in Bash

Posted: Mon Feb 20, 2012 2:37 pm
by pmjdebruijn
wynteriii wrote:UNIX?........So many memories come to mind. It also brings up Ubuntu which brings up so many nightmares.
I'm not really trying to open a can of "what OS is best" here... So please don't flamebait...

Re: Random Character Generator in Bash

Posted: Mon Feb 20, 2012 2:53 pm
by dymondy2k
I haven't used BASH since my college C class. Sounds like a cool little tool though. and I don't think he was trolling, I bet most of us nerds have had a love/hate relationship with Unix/Linux at some point.

Re: Random Character Generator in Bash

Posted: Mon Feb 20, 2012 3:53 pm
by wynteriii
I'm not a ner.....well... that's beside the point.

Re: Random Character Generator in Bash

Posted: Mon Feb 20, 2012 11:48 pm
by Solomoriah
Well, I am a nerd. I'm posting this from my tablet, which I reloaded with CyanogenMod7 because the stock OS sucked. While I can see the attraction of bash, I do my own development in Python. (2.x because I hate 3.x... see, a real nerd).

Re: Random Character Generator in Bash

Posted: Tue Feb 21, 2012 1:06 am
by dymondy2k
NERD!!!!!!! Oh wait.. My tablet is also running Cyanogen 7..

BTW I cannot say enough good things about the Dice Bag app..

Re: Random Character Generator in Bash

Posted: Tue Feb 21, 2012 8:35 pm
by Sir Bedivere
Hey, I like Ubuntu. After Mandrake was transmogrified into Mandriva, I switched over and thoroughly enjoyed it as my sole OS until my laptop screen broke. (Through no fault of the OS, I might add; the hinge that held it to the body broke, so the screen wouldn't stand up.)

EDIT: Oh yeah, since I'm commenting on an OS, I should include the legal fine print: The author's own enjoyment of above-mentioned OS does not imply, and neither should one infer from it, that it is the World's Best OS(TM), or even that it will work on your machine, with your peripherals, or your personality, much less that you will like it. The author disavows any intention to begin, stoke the embers of, continue, resume, end, or in any other way participate in an OS-related flame war, or any other kind of flame war, either here or at any site that may be linked from the original post or that may link into the original post, or any subsidiary posts, either now or in the future. Unless it is about Elves.

Re: Random Character Generator in Bash

Posted: Tue Feb 21, 2012 9:58 pm
by SmootRK
I like ubuntu as well. Occasionally I convince someone who has never used anything but windows to try it (and unless they are gamers) they usually like it too- especially the price.

I find it especially useful for making older gear useful again.

Re: Random Character Generator in Bash

Posted: Wed Feb 22, 2012 12:30 pm
by wynteriii
pmjdebruijn wrote:
wynteriii wrote:UNIX?........So many memories come to mind. It also brings up Ubuntu which brings up so many nightmares.
I'm not really trying to open a can of "what OS is best" here... So please don't flamebait...
You should know we nerds can't help ourselves when it comes to tech.