The Project

Summer 2015, I started getting passionate about how I could use advertising to support charity. After trying to build an alarm clock that woke people up with video ad’s, I decided to make a mobile trivia game. I took an archive of Jeopardy Questions and filtered out all answers that were not four letters long. Ads only appear if you run out of points. Points are gained by typing in the answers correctly. Points are used to buy hints, which give you one of the letters needed for the correct answer.

Technical Challenges

4 letter words was all about learning JavaScript. I approached the project without too much formal experience, and walked away feeling like I knew what I was doing. I mostly used a bunch of static functions to process the flow of the data, when things were clicked on. One thing I was proud of was how I kept a persistent psudorandom set of letters to pick from for each question.

I believe it would be tedious to serialize & deserialize the contents of what letters are on the screen every time you open the application. To solve this, I just came up with a function that would determine weather to display the letter, given some deterministic properties about the question. This is demonstrated in the named function ‘shouldUse’:

//takes a letter, and returns a boolean.
//Function that takes a letter and determines
// if that letter should be in the set of
// letters to pick form.
function wordContains(g) {
    //shouldUse:arbitrary function that returns
    // a boolean, indicating if the letter should
    // be used for the word as a decoy, when the
    //letter is not actually in the word.
    function shouldUse() {
        var show = data[questionPos]["show_number"];
        var toTake = (questionPos % 4) + 1;
        return ((parseInt(show.charCodeAt(toTake)) % g) >= (g / 3));
    var contains = inWord(g);
    if (!contains && shouldUse() &&
    (lettersUsed < (maxLetters - word.length)) && g != 26) {
        contains = true;
    return contains;