Giter Site home page Giter Site logo

akstria's Introduction

Akstria

Generates random words with a syllable-based algorithm. The name for this repository was generated with it. This is an old project from when I first learned how to create forms in C#. The request I was given was simple: Build a program that randomly creates fictional "words" for the user. The idea behind it was to create large wordlists that the user can look through, picking words to build a fantasy langauge. After proving the concept with a character-by-character algorithm, I designed a syllable-based algoritm to improve the amount of usable words that the program outputs. Below is a description of the current algorithm, organized according to what happens when one of the buttons is pressed.

#Generate

[button1_Click]

-String arrays for all syllable types are created, then populated with the contents of their respective text boxes.

--createWords method is called with these arrays and the result of method trackBarSums as parameters

---trackBarSums simple returns the sum of the trackbar values representing the "weights" (or probabilities) of each syllable type.

----The length of words and number of words are stored, and the program enters the main word-generator loop

-----While the number of words created is less than the chosen length...

------An empty string 'word' is created,

------While the word is less than the chosen number of syllables...

-------A string returned by the method getSyllable is appended to 'word'

--------getSyllable parameters call the method pickSyllableType, which calls getProbs to store the weight of each syllable as a percentage

--------and also calls getSeed to generate a random number 0-100

---------getProbs returns an array of the 11 syllable types weight (its value * 100 / the sum of the trackbar values)

---------local_sum is iterated through all 11 syllable types and the selected type is returned when the result of getSeed is less the weight of active syllable type

---------inside of getSyllable, empty string 'syllable' is created the syllable type is run through a switch statement

----------the switch statement sets the syllable to the element at an index chosen by getSeed from within its respective textbox, as stored in the first step.

-------Syllable separator string is appended to 'word'

------'word' is appended to the main textbox along with the word separator string

------And the main textbox is manually updated for each word.

#Clear

[button2_Click]

--The main textbox is cleared, then manually updated

#Save

[button4_Click]

--Basic steps to save the generated wordlist to a file, look this up elsewhere if it's hard to understand

#Test RNG

[button3_Click]

--All trackbars are zeroed out

--For 400 iterations

---A trackbar is chosen randomly with getSeed and has its value incremented

--The weights of these are then displayed in the main textbox (weights should be around 36 +/- ~11)

akstria's People

Contributors

tk3950 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.