Cryptofun

Cryptofun website screen capture

Cryptofun Website

Visit site: http://lisalhilton.com/cryptofun/ourpuzzles.html

Technologies used: HTML, CSS, PHP, MySQL, JavaScript

Review of work: This is the final project for my JavaScript class. I had been looking at some programming challenge websites to come up with an idea for the project, and this one piqued my interest. I enjoy cryptograms, along with other puzzle games, so I decided to build a cryptogram maker. In addition to presenting the user with puzzles, I also included the ability for users to input cryptograms from other sources, and I also allow users to input their own quotes to develop cryptograms that they can print out and share.

The main work on the site was done in JavaScript. First, though, I put together a MySQL table of quotes and authors and used a PHP script to pull out the quotes and authors and put them into JSON. I use JavaScript to develop a scrambled alphabet and encode the quote and author’s name. Scrambling the alphabet was actually the biggest challenge for the site. It was important that no letter actually end up not scrambled, but my first solution meant that the program would spend a lot of time trying to scramble the last letter.

JavaScript code to scramble the alphabet

Original alphabet scramble code

To solve the problem, I stop the scramble just before the last letter and, if it’s the same letter, swap it with a different letter instead.

JavaScript code for new alphabet scramble

New alphabet scramble code

Possible next steps: While the code works, I’d like to keep looking for a more elegant solution in order to scramble the alphabet. This might be easier to do in PHP or utilizing jQuery. I’d like to also improve moving among the letters a little better, perhaps having a user-selectable option to skip letters that you’ve already entered when you put in a letter. It might also be good to add some user tracking to make sure that a user doesn’t get the same puzzle in a session, to track the number of puzzles completed, hints used, and other statistics.

Leave a Reply

Your email address will not be published. Required fields are marked *