Mixed Messages - Fallout New Vegas Character Generator

Created a Fallout New Vegas Character Generator.

Took me around an hour to complete from inception. Just wanted to create a random character I can explore the wastelands with for my next playthrough.

Comments is much appreciated, especially on how making the code shorter.

Future plan, if I feel up to it, is to calculate the initial SPECIAL and skill values, after the character is initialized. Also maybe put it in a site?

Link to code here:

Greetings! I loved your project it was super fun and worked really well.

I have two suggestions for readability and design that could be used to refactor this project if desired.

Switch Statement: This functions perfectly fine but may minimize the code if you relied on the array indexes in the special_array instead of their value. It may take some design rework but you could randomly generate a new array of stats. So you could rely on their indexes and just randomly pick an index to increase. It would eliminate the use of the very tall switch case into just a while loop until you have spent as many increases as desired.

Helper Functions: Math.floor(Math.random() * some_number) is used many times. Perhaps it would make it more readable to take some of these out and make them into very small functions. So you could get these random numbers with a specialRand() call instead.

Great project! Super fun!

thanks for the suggestions especially the one regarding the switch statement. that’s a nice approach that i’ll take when I integrate this into a website in the future.