Character RNG Challenge
I found this on here somewhere, but don't remember where:
It was called something like "My Next Character: RNG Challenge" The instructions were to use your favourite random number generator for the following categories: Class = 1-7: Scion, Witch, Shadow, Ranger, Duelist, Marauder, Templar Ascendancy = 1-3: left, middle, right according to gamepedia Defense = 1-2: life, energy Offense = 1-2: attack gems, skill gems Weapon = 1-3: 2-hand, dual wield, 1-hand Two-hand = 1-5: Bow, Staff, Axe, Mace, Sword One-Hand = 1-6: Claw, Dagger, Axe, Sword, Mace, Wand I took this idea and made a little web app out of it: It's GitHub page. Currently not hosted anywhere. Probably will be soon. SynTrSr - Trickster Soulrend/Bane Last bumped on Jan 12, 2017, 8:40:00 PM
|
|
RNG challenge
Stop NO MORE Dys an sohm
Rohs an kyn Sahl djahs afah Mah morn narr |
|
While the idea is interesting (even if I_NO doesn't like it), and appreciate you sharing your code, the code itself is rather limited and organized in a non-standard way. As a web and desktop app developer, it makes me cringe, lol.
You have your javascript broken into three files for no apparent reason. Usually programmers will break things into different layers. Example: UI, Business, and Persistence (Data Access). In your case, everything is what we'd call a business layer in your javascript (except for the DOM calls, which is both Business and UI). And since they're all only 20-40 lines long each, just put it in one file. No need for the awkward "array.js", "driver.js", and "rng.js" names. Keep your file naming of the same categories. The HTML and CSS would be the UI portion. I don't mention this to be a jerk, I just do so to help aspiring programmers. :-) ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▒▒▒▒░░░░░ cipher_nemo ░░░░░▒▒▒▒ │ Waggro Level: ♠○○○○ │ 1244 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ |
|
Also, since the whole point of this is to be random, don't use Math.Random() in javascript. Use a better random library. Cryptography obsesses over randomness, so any crypto library will be fine (example: CryptoAPI. But if you want something a little easier to wield, don't re-invent the wheel, and use something specifically designed to generate a better random value. Examples:
http://chancejs.com/ https://github.com/ckknight/random-js http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▒▒▒▒░░░░░ cipher_nemo ░░░░░▒▒▒▒ │ Waggro Level: ♠○○○○ │ 1244 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ |
|
Cipher, I appreciate your reaching out to help me become a better programmer. I'm used to Python and C++ where modularity and breaking code out into different files is the convention. I see your point though. It's such a short app that it didn't need to be done that way. It's basically three functions and some constants. I will change this.
However, I don't agree with using a whole new cryptography library for something so basic. If it was for an app that had more meaning, I could see doing so. ~Dave Edit: Changed. SynTrSr - Trickster Soulrend/Bane Last edited by generaldave on Jan 12, 2017, 2:37:36 PM
|
|
" If you use a library, it's actually LESS code for you. No need to format your values for Math.Random() anymore. Just plug in what you want for calls for those libraries. You don't need to use CryptoAPI, as it's overkill, but one of the other ones I linked keeps you from re-inventing the wheel. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▒▒▒▒░░░░░ cipher_nemo ░░░░░▒▒▒▒ │ Waggro Level: ♠○○○○ │ 1244 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Last edited by cipher_nemo on Jan 12, 2017, 3:07:25 PM
|
|
Also...
" Proper layout of application development is not language specific. You can break things into multiple files for larger projects, that's fine, but the concept of organizing by layers is more universal to development. For such a small project, just put the same business layer stuff in one file. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▒▒▒▒░░░░░ cipher_nemo ░░░░░▒▒▒▒ │ Waggro Level: ♠○○○○ │ 1244 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Last edited by cipher_nemo on Jan 12, 2017, 3:56:13 PM
|
|
Great idea, thanks.
Btw cipher is just jealous, ignore him. |
|
Cipher's fine. He's not hurting anything, just trying to give coding advice. It's up to me to take the advice or not. Either way, there really is no right or wrong way to code. Everyone has their own style. As long as it suits readability, efficiency, and some other standards its fine. He's made valid points that I adjusted to, and some that I don't necessarily agree with that I didn't adjust to. That's the way things work.
And you're welcome, saysay SynTrSr - Trickster Soulrend/Bane
|
|