Game Instructions

Tap a tile to toggle its color. When a tile changes nearby tiles may change as well. Each move affect multiple tiles. The target is to turn all tiles into yellow in the fewest steps possible.

Press 'j' to show/hide the game. Press 'i' to show/hide the instructions. Press 't' to show/hide the top score table.

Steps: 0

Top Scores

Name Steps
Press J to toggle the game, I to toggle instructions, and T to toggle the top scores

Congratulations!

You solved the puzzle in 0 steps!

Success!

Score submitted successfully!

Error

Failed to submit score. Please try again.

PouchDB Jump Start PRO

PouchDB is a small JavaScript library that provides us with the functionality of a document oriented database. We can use it both on the server and on the client.

The following is the code that I was using in this video clip. Make sure you update the link to the PouchDB JavaScript file before you run it.

<!DOCTYPE html>
<html>
<head>
    <title>pouchdb sample</title>
    <script src="http://download.pouchdb.com/pouchdb-nightly.js"></script>
    <script type="text/javascript">
        var db = new PouchDB('books');
        function addBook() {
            var booktitle = window.document.bookform.titlefield.value;
            var bookisbn = window.document.bookform.isbnfield.value;
            var bookauthor = window.document.bookform.authorfield.value;
            var book = {
                _id: bookisbn,
                title: booktitle,
                author: bookauthor
            };
            db.put(book, function callback(error, result) {
                if (!error) {
                    clearFields();
                    document.getElementById("message").innerHTML =
                            "the new book was successfully added";
                }
            });
        }
        function clearFields() {
            window.document.bookform.titlefield.value="";
            window.document.bookform.authorfield.value="";
            window.document.bookform.isbnfield.value="";
        }
        function showBooks() {
            db.allDocs( {include_docs: true, descending: true},
                        function(err, doc) {
                            showTableOfBooks(doc.rows);
                        } );
        }
        function showTableOfBooks(data) {
            var div = document.getElementById("message");
            var str = "<table border='1' aligh='left'><tr><th>isbn</th>"+
                    "<th>title</th><th>author</th></tr>";
            for(var i=0; i<data.length; i++)
            {
                str +=  "<tr><td>"+data[i].doc._id+
                        "</td><td>"+data[i].doc.title+
                        "</td><td>"+data[i].doc.author+"</td></tr>"
            }
            str += "</table>";
            div.innerHTML = str;
        }
    </script>
</head>
<body>
    <form name="bookform">
        book title <input type="text" name="titlefield" />
        <br/>
        book author <input type="text" name="authorfield" />
        <br/>
        book isbn <input type="text" name="isbnfield" />
        <br/>
        <input type="button" value="add book" onClick="addBook()" />
        <br/>
        <input type="button" value="clear fields" onClick="clearFields()" />
        <br/>
        <input type="button" value="show books" onClick="showBooks()" />
    </form>
    <div id="message"></div>
</body>
</html>

You can find the complete sample with all the other files it uses as well as slides and video clips for learning how to use this library in my new PouchDB Basics free course at http://abelski.lifemichael.com.

Share:

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences