Projects

The status of these projects include anything from “done” to “proof-of-concept” to “partially completed” to “hey, wouldn’t it be cool if…?” I’ll try to keep things here up to date as best I can, but…you know…life happens. I’ll add more details to these (code, demo pages, etc.) as time allows.

  • Sudoku Solver

    Around 2010, I got a sudoku puzzle book to help me pass the time on a long flight. The unfortunate side-effect of this was a serious addiction to sudoku. I ended up solving several hundred puzzles over the following few weeks. Anything below the ‘hard’ difficulty became completely uninteresting to me. I got to the point where I was having trouble finding puzzles that challenged me. Recognizing my habit as an addiction, I decided the only way to alleviate my condition was to write a program that could solve the puzzles for me. In my mind, that would indicate to me that I truly ‘understood’ the puzzle and would no longer need to devote any time to sudoku. I wrote up a Javascript solution (back before I would have even considered myself good at JS) and I recently rediscovered my code (in a sub-folder of a backup folder on an old external drive).

    Demo

  • Sudoku Solver Revisited

    So, yesterday (9/8/2018) I had an idea that my old Sudoku solver was using too many rules.  I tried to think of a generalization to boil it down to one rule (The “cancel rule”).  I also had an insight that I shouldn’t be worried about rows versus columns vs groups.  If I just had a way to map rows/columns/groups to ordered lists and had the reverse mappings, then I could simplify things considerably.  I coded up a new solver program.  It did well on easy and medium difficulty puzzles, but it wouldn’t complete the harder difficulty puzzles.  Looking at the results, I thought of another rule (The “exclusive possibility rule”), which turned out to be a sort of opposite to the first rule.  The algorithms to implement them were actually quite similar.

    There are some extremely difficult puzzles these two rules alone won’t solve.  I can think of rule that does involve looking at a group specifically to see what inferences can be made to intersecting rows and columns.  I think I’ll call that the “group inference rule”.

    (A little while later…) So, the group inference rule does help, but it’s not enough for really tough puzzles.  I’m trying to avoid implementing the “what if…rule” in which I look at what would happen if I selected a particular possibility of an entry and compare that to the other possibilities and then find the overlapping results, but it might just come down to that.  And after implementing the inverse of the group inference rule as well, I think there’s a real possibility that the “what if…rule” is unavoidable for solving the hardest difficulty puzzles.

    (Another day later…) I half-way implemented the “what if…rule”.  During testing I noticed that some choices led to boards with boxes with no more possible values, which is obviously against the rules.  So, I just check for that and eliminate that option.  So far, I haven’t needed to go beyond a branching factor of 2.  Until I find a puzzle that this code can’t solve, I think I can stick a fork in it.  It’s done.

    Demo

  • Side Mounted Menus

    This project was something I was experimenting with to maximize the screen space available for actual content. As a principle, I don’t think that elements should be visible unless they are needed. Navigation menus, in particular, can sometimes take up lots of screen space. While they are essential to a site’s overall functionality, they do take available space away from the content, which is the reason the visitor is on the page in the first place.

    The real functionality of this comes from CSS3. I only added some Javascript to aid in the construction of the necessary HTML elements because it would be the same every time. The CSS expects a certain structure and the Javascript builds it that way.

    Demo

  • Content Loader

    This project is started off as an “infinite scroller”, but in my typical fashion of generalizing for reusability, I generalized the content loading portion of the infinite scroller and let child components trigger the content loading in different ways. So, the infinite scroller turned into a general component (ContentLoader), and two child components (ScrolledContentLoader and TimedContentLoader).

    The philosophy I have on this is that, not only should I not have to look at elements on the screen until I need them, but the elements shouldn’t even be transfer to my computer until just before I need them. For example, consider a YouTube video page. More often than not, I don’t care to see the comments. If I want to see the comments, I’ll scroll down. That should be the cue to load the comments (or MORE comments if some are already loaded). That way, it saves on bandwidth and the page becomes more responsive to user actions.

    There’s an issue with the scrolled content loading that I haven’t fixed yet. If the scroll bar reaches the bottom then it won’t load new content unless you first scroll up. I’m guessing it’s one of those edge cases that ended up requiring disproportionate amounts of code to fix. I’ll get to it later…maybe.

    This project relies on jQuery.  It’s not perfect, but I learned a lot about the primary concerns necessary to address when making/using an infinite scroller.

    Demo

  • Genetic Algorithm Engine

    I’ve always found the idea of randomized solution generation fascinating. One day, I decided to try to implement a basic genetic algorithm engine in Javascript. The engine accepts a phenotype (an object that dictates the behavior of the “species” and how to represent its “DNA”) and some options (population size to maintain, probability of crossover, probability of mutation, etc.). I tried to design it so that the engine handles everything relating to determining which objects get to stay in the population and which have to go as well as choose “mates”. The phenotype basically handles anything that involves manipulation of the DNA and determining the fitness of the specimen.

    This is a project that I’ve revisited/reimplemented from time to time. I like the wide solution sets that the “dumbness” of genetic algorithms can offer. Though, the more I learn about machine learning, the less impressed I am with them. Anyway, here’s one rendition of the project…in Javascript.

    Demo

  • 2048 Heuristics

    As further personal study into artificial intelligence, when I first learned about the basics of heuristics I decided to apply them to my favorite online puzzle game, 2048. Once I hooked into the code and figured out how to get a function to pick actions and play them, it was just a matter of figuring out the right rules to play the game. I added the ability to look into the potential future of the game, but that slowed down processing considerably (since I was simulating many potential moves for every actual move).

    The heuristics are somewhat naive. They don’t tend to recover from bad situations very well. They just try to avoid allowing bad situations to happen. There’s probably a more complicated heuristic to deal with digging low valued pieces from out of high valued surroundings, but that would be a bit involved for my level of commitment on this project. Also, increasing the depth actually tends to make the algorithm do worse because I don’t do probabilistic piece generation for the subsequent steps, which is what would happen in the game. The problem with that is that I have generate a 2 or 4 (4 with a 10% probability) for each empty space and then calculate an expected value for the move based on all of the possible outcomes. While this would be the most accurate, it would also be the most computationally intensive.

    I made a little interface for choosing the multipliers for the individual rules so that different values can be tested out.

    I actually made a “learning” version of this project that used Q-learning to modify the heuristic weights over a series of games (it would just keep playing). I can’t for the life of me find that code though 🙁

    Here’s a video of one rendition in action

    Demo

  • Digital Footprint Obfuscator (DFO)

    So, I recently listened to the audio book of Future Crimes. It highlighted the permanence of information stored regarding people’s Internet usage behavior and how it gets used. Some people, like Gary Vaynerchuk, are perfectly ok with advertisers learning how to more accurately target their customers. However, even if you trust the companies that obtain your information, that doesn’t mean that they won’t lose that information to a cyber criminal.

    As an end user, there isn’t anything legal you can do to eliminate the data on them that is already out there. The next best thing is drown the real data in a sea of false data. Hence, the digital footprint obfuscator. The “dumb” version of this might simply just browse a dynamic list of URLs to at least obfuscate the ISP’s records. A slightly more advanced version would be able to log into social media sites and browse around or perhaps even perform actions like ‘liking’, ‘sharing’, or even posting content. Granted, the friends of the DFO would probably be confused and/or irritated by this, but someone may need the obfuscation more than they need happy friends.

    I was thinking that DFO could be provided as a service in which you might be able to select a particular type of digital footprint to product (e.g. soccer mom, angsty teen, sports fan, etc.) and the server would search the Internet and social media sites for URLs related to those footprint types, feeding those URLs to the client.

    Status: mostly ‘idea’ stage right now…just playing with providing URLs from a server.

  • Neural Network Builder

    While learning neural networks, I was thinking it would be nice to have a simple drag-n-drop interface for creating simple neural nets and running data through it. Things like learning rate, activation functions, cost functions, etc. could be parameters. Having various charts to show some statistics over time as well as having a sort of history/rewind/single-step feature would be nice to aid in learning. I know that grasping the backpropagation algorithm took me quite a while before I ‘got it’.

    Status: Purely ‘idea’ stage right now. Honestly, I’m hoping that someone else has one of these already that I can just use.

  • FTD Web Order Interface (WOI) Service

    So, my family has a flower shop. I’ve periodically been recruited to assist in some web development tasks. One such task was sending a web order to their FTD Mercury system for processing. This seemed simple enough to me but was actually a massive pain in the butt. The documentation was lacking (they fixed it after this particular sequence of calls with me). I banged my head against a wall for weeks and eventually. After several calls with their upper level support staff, I was informed that they did indeed neglect to specify the cipher and padding modes that their server expected. Once I got it figured out, I copied the code off to a safe place and made sure not to mess with it, lest I screw up the delicate configuration (a misplaced newline character could screw up the whole thing).

    My idea here was to provide this functionality as a web service. It would require giving my server some sensitive information to work, but I personally don’t care about the encryption mode used by some random florist’s FTD system. I just need to set up a user management system around the code to allow people to access it.

  • Web Card Game

    As a matter of exercise and maybe leaning towards making some kind of online version of Overpower, I want to make a generic card game component.

    Status: I’m making some progress on this in my spare time. I have a database schema started and some Javascript and PHP scaffolding going.

  • More to come…