This is a collection of Javascript files that I've accumulated over the past several of years. Most of these are demonstrations or experiments to see what can be done in Javascript. Many of them have useful functions that can be extracted for use in other places.
|
File |
Description |
| Javascript Speed Trials |
February 2006 I was interested in finding out how quickly certain Javascript expressions are executed (especially string concatenation). This file performs some simple benchmarks. Interestingly, FireFox is WAY FASTER than IE6 - averaging under 20 microseconds to append a 10-character string to another string, while IE can take from 200 to 1000(!) microseconds to perform the same action. Not only that, but RAW execution speed of Javascript in Firefox seems to be 8 times faster than IE6! I believe BOTH browsers take more than constant time on average (since they have to re-allocate and copy the old string to append the new one to it). |
| Sudoku Solver |
January 2006 Protoype for a Sudoku solver. View source to see the input format. The page is rendered completely in JavaScript and is designed to show the steps a person could take to solve the given Sudoku puzzle. |
| Rubik's Cube Simulator |
April 2003 Following up on my WildTangent programming class, I thought it would be fun to write a Rubik's cube simulator. |
| GeekWeek |
April 2003 I created a development environment for writing 3-D programs in JavaScript using the WildTangent engine. See also a game sample based on a WildTangent demo (past into the code section of the stage environment and run it). See also an API summary of the environment. |
| Object-Oriented Programming |
REVISED January 14, 2006 I've written a summary of various techniques I've used to develop an object-oriented programming style in JavaScript. The document is actually rendered largely using JScript itself (since much of the document are program fragments and examples). |
| self | JScript hack - web page whose source is the same as it's display. This version is 195 characters long - can you come up with a smaller one? (My first attempt - at 257 characters is here). |
| browsercaps | Displays information about the browser. |
| Scroller |
September 2000 This summer, Scott McCloud, author of Understanding Comics, came to Microsoft to give a talk. At one point, he mentioned that he wished that readers could just "grab" onto web pages with the mouse and sling them around - rather than have to resort to using the scroll bars [This effect is reminiscent of some of the early Print Preview features on the Mac]. I copied a page from Scott's web
site, and added some code that would allow you do just that. Try
clicking in the page and drag it around; "sling it". You
can also use the arrow and page up/down keys to sling the page
up/down/left/right. |
| Hex |
September 2000 An extension of my interesting in abstract games - here's a prototype "Hex" game. The board is implemented as a collection of VML objects, rather than using standard HTML. |
| Persist |
August 2000 A set of functions that can be used to persist and restore an arbitrary network of JavaScript objects into an XML stream. The JavaScript to XML direction is written purely in JavaScript. The XML to JavaScript direction also uses the MSXML parser built-in to IE 5 and higher. |
| ows.js |
August 2000 There are quite a few useful functions in the JavaScript source file that we are shipping with the upcoming release of Office Web Server (at a whopping 66K, it better have some useful functions)! Functions include forms editing and validation, a date picker, calendar view, survey view, Date parsing functions (for early versions of Navigator JavaScript that did not have these functions available), formatting of localized dates and numbers, character encoding utilities, and browser version checking. Good example of object oriented programming using JavaScript. (Note that Microsoft holds the copyright to this file and it is subject to Microsoft's licensing restrictions.) |
| Quoridor |
August 2000 At present, this contains code for playing a two person (at the same computer) game. It contains a valid move generator, an evaluation function, and a graphical board display. Good example of data structures, and event processing. Parts may be easily generalizable to play other board games. I plan to add AI to the game so you can play against the computer.
|
| Enigma |
August 2000 Functions that can emulate an Enigma-like device. Computer permutations and has rotation functions. Also has permutation display functions.
|
| ActiveX |
August 2000 Demonstration of using Enumeration object to build an XML-format from extracted property information (table driven). This was a sample experiment for code that went into Office Web Server to do Outlook import.
|
| Profile |
March 2000 An experiment to determine the number of iterations needed to achieve a given degree of accuracy using the JScript Date functions as a timer.
|
| Evolve |
March 2000 This is a particularly interesting hack. I created a virtual machine language that I used to create programs for solving the Max-Sum-Subarray problem. I think randomly mutate an initial solution and compute a "score" for the desirability. This is an incomplete experiment in using genetic programming to derive optimal program fragments. |
| Image Cycler |
February 2000 Some routines that cycle between a collection of images. I use this to display a day's worth of web cam images as a time-lapse animation. |
| Structured Graphic | I didn't write this one, but I thought it was a clever demonstration of the use of the drawing activeX controls built into IE (in future, I'd probably prefer to use VML to achieve calculated graphical images in web pages. |
| Ball (Head) | This was a sample program I helped Chris with for a 4th grade project (spring of 1998) - it bounces an image of Chris's head around a box on the screen. Parameters can be changed to adjust initial velocity and "gravity" (actually looks like this version is broken in that the head does not "bounce"). |
| Alice |
January 2000 A demonstration of the probabistically generated text based on N-gram frequency distributions. Choice of larger and larger N-grams creates a text closer and closer to Alice's Adventures in Wonderland. (Werner is the same program with a different and shorter text used to generate the frequency distributions). |
| Ciper Challenge |
January 2000 Programs to assist in cryptanalysis of the ciphers in the appendix of Simon Singh's The Code Book. |
| Asteroids | One of the original IE 4 demos of DHTML - an amazingly good simulation of the original asteroids game. |
| Junior Pokemon | The beginnings of a map-based game that I was helping Chris with. A piece can be moved around the screen using the arrow keys, and sounds are played when obstacles are encountered. Never completed. |