Tuesday, July 27, 2010

Pallette color cycling

Old School Color Cycling with HTML5
A good description of the technique with fantastic examples, including JavaScript and C++ code.

Sunday, July 18, 2010

Sourcerer code

“A computational process is indeed much like a sorcerer’s idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions. It can affect the world by disbursing money at a bank or by controlling a robot arm in a factory. The programs we use to conjure processes are like a sorcerer’s spells. They are carefully composed from symbolic expressions in arcane and esoteric programming languages that prescribe the tasks we want our processes to perform.”
from Structure and Interpretation of Computer Programs by Abelson, Sussman and Sussman.
Below is the html code (with embedded javascript) that our programming group tinkered with. All it does is draw a few rectangles, two filled with a linear gradient. The interesting bit is that this can be done; using the HTML5 canvas element, anything can be dynamically drawn on a web page. This Conway's Game of Life is a simple example of using HTML5's canvas tag to make an interactive program.

Note that I can't post the exact code because blogger interprets well-formed tags as html. I've replaced the initial "less than symbol" with a "[" and "greater than symbol" with "]", and these will need to be replaced. To tinker with the program, copy it to a text file and change the extension to .htm or .html, replace the symbols, and open the file in any browser. If this page is publicly posted, any browser can run the program. (I haven't posted the page, but I will soon.)

[!DOCTYPE html]
[html lang="en"]

[head]
    [title]My test canvas[/title]
[body]


[!-- comment --]


[canvas id = "canvas_1" width = "800" height = "400" ]
    This text is displayed if your browser does not support HTML5 Canvas.
[/canvas]



[script type="text/javascript"]

    var example_canvas = document.getElementById( 'canvas_1' );
    var draw_context   = example_canvas.getContext( '2d' );

     var lingrad = draw_context.createLinearGradient( 0, 0, 0, 150 );
     lingrad.addColorStop( 0.0, '#00ABEB' );
     lingrad.addColorStop( 0.5, '#fff'    );
     lingrad.addColorStop( 0.5, '#26C000' );
     lingrad.addColorStop( 1.0, '#fff'    );

    draw_context.fillStyle = lingrad;
    draw_context.fillRect( 30, 30, 150,  50 );
    draw_context.fillRect( 110, 110, 130, 130 );

    draw_context.strokeRect(  50,  50,  50,  50);
    draw_context.strokeRect( 150, 150, 150, 150 );

[/script]



[/body]
[/head]

Saturday, July 10, 2010

Teletype gaming and LOVE

Short text based interactive game programs, at the dawn of gaming as an industry, were in a sense simple and trivial. But their influence on the narrow group of people who encountered them was profound. What was behind the curtain? Is this high tech timesharing system a toy, or just being used as a toy? The answer surprised everyone.

For retro-programmers the full content of the book "Basic Computer Games" is available online.
The classic book BASIC Computer Games, published by Creative Computing, inspired a generation of programmers. The games were written by many people, and compiled by David H. Ahl. The fabulous illustrations accompanying each game were done by George Beker.

I've included all the games here for your tinkering pleasure. I've tested and tweaked each one of them to make sure they'll run with Vintage BASIC, though you may see a few oddities. That's part of the fun of playing with BASIC: it never works quite the same on two machines. The games will play better if you keep CAPS LOCK on, as they were designed to be used with capital-letter input.
These text games were designed for teletypewriters or line printers, in an era when memory was valued, succinctness was necessary, and GOTO was considered useful. (Currently "Go To Statement Considered Harmful".)

I've only browsed the contents of more than 100 games. The style is short and sweet: a description of the game, an illustration of a session, and the BASIC code itself.

One of my favorites, although I didn't encounter it back in the days of teletype terminals, is LOVE, an instance of ASCII art programmed by David Ahl, the author of the book. The program generates a facsimile of the iconic pop-art piece LOVE, by Robert Indiana, with a dose of recursion.

Here is Artsy's gallery of Indiana's corpus of work, which gives a good sense of his range.
"I think of my peace paintings as one long poem, with each painting being a single stanza."
-Robert Indiana
 

A younger generation might more easily recognize Indiana's HOPE graphic, created for and used in Obama's 2008 presidential campaign.


Wednesday, June 30, 2010

AI in the New York Times

The New York Times, although no longer wholey a dead tree company, is not known for reporting on the cutting edge technology issues. When it does feature technology, it is usually focused on what works in practice, not on futuristic speculation. It's recent article about the technological singularity, "Merely Human? That’s So Yesterday", is a bit dismissive about an idea that is far from new, and uses Sergey Brin as a lead element because of his fabulous success in business as much his embracement of the future.


So it is remarkable that three NYT articles appear this month that take AI seriously. All focus, more or less, on business aspects of AI. While the topic of artificial intelligence has grown up with electronic digital computing, its reputation has been tarnished by its percieved failures and shortcomings. This attitude is changing, and the Times is catching up:

What Is I.B.M.’s Watson?

 For the last three years, I.B.M. scientists have been developing what they expect will be the world’s most advanced “question answering” machine, able to understand a question posed in everyday human elocution — “natural language,” as computer scientists call it — and respond with a precise, factual answer. In other words, it must do more than what search engines like Google and Bing do, which is merely point to a document where you might find the answer. It has to pluck out the correct answer itself. Technologists have long regarded this sort of artificial intelligence as a holy grail, because it would allow machines to converse more naturally with people, letting us ask questions instead of typing keywords.

Computers Learn to Listen, and Some Talk Back

For decades, computer scientists have been pursuing artificial intelligence — the use of computers to simulate human thinking. But in recent years, rapid progress has been made in machines that can listen, speak, see, reason and learn, in their way. The prospect, according to scientists and economists, is not only that artificial intelligence will transform the way humans and machines communicate and collaborate, but will also eliminate millions of jobs, create many others and change the nature of work and daily routines. 

Technology Innovator’s Mobile Move

“We are looking to augment human capability,” said Norman Winarsky, vice president for licensing and strategic programs at SRI. “But with artificial intelligence.”
Established in 1946 by Stanford University, SRI created early prototypes of the computer mouse and the technologies involved in ultrasound and HDTV, amongst a slew of other technology developments.
Although SRI does roughly 80 percent of its work for the federal government, many of its technologies have been adapted for commercial purposes. Recently, the institute has set its sights on the mobile phone and Web market, especially on creating applications that perform personal functions.

Wednesday, June 23, 2010

Physics simulation games

Ragdoll Cannon is a flash game with that uses 2-D physics in a very nice way. It's graphical design is beautiful too. A Boing Boing comment indicated that it looks like a knock-off of the (commercial) Crayon Physics.

What are the other games we've run across that use physics simulation in the same sense?

Tuesday, April 27, 2010

Google question relative frequency

Frances posted lists of odd things that people asked of Google.

I wondered how often people ask questions of Google. Of course Google has good statistics on this, plotted nicely with Google Trends.

There are some firm conclusions:
  • More questions are asked during the Western school year, with a sharp drop near Christmas.
  • In the last few years the frequency of asking Google has increased dramatically.
  • While "why is"  is historically less frequent than "how does", it currently is nearly identical in frequency. Why is that? Perhaps it is because of increased incidence of "why is my poop green".
 

 


2025-2-25


      The "why is" vs. "how does" difference has grown significantly.


 
     The academic year cycle variance has moderated, but the pattern is similar.



    Maintained interest about green poop. Now there is a clear peak in July; I don't know why.




Tuesday, April 13, 2010

Other worlds

The current (2010-4-13) count of known exoplanets is 452. Some have retrograde orbits.

"Turning Planetary Theory Upside Down: Nine New Exoplanets Found, Some With Retrograde Orbits", ScienceDaily, 2010-4-13


Since then follow-up observations and new survey missions and methods, particularly using transit photometry, have ballooned the count (2024-7-22) to more than 6,660 exoplanets. 

"Most Planets in the Galaxy Orbit Stars You Can't Even See", Phil Plait, Scientific American, 2023-4-10

Discovery of Exoplanets, Wikipedia 


Exoplanet dicsoveries by year and method (up to 2018)

https://en.wikipedia.org/wiki/Discoveries_of_exoplanets#/media/File:Exoplanets_discovery_methods_chart.png



 


Tuesday, April 6, 2010

Getting closer to AI vision

I've been admiring the book "Eye, Brain, and Vision" by David H. Hubel (Scientific American Library series no. 22, 1988) for a while now. The illustrations are very good, and the discussion of what is (was) known and unknown is well written and complete. Not too much of the fundamental understanding of vision has changed since then.

[1/14/2011 This book, with supplementary material, is available online: David Hubel's "Eye, Brain, and Vision"]

Hubel (with Weisel) has deeply influenced neuroscience, particularly visual and cognitive neuroscience, for half a century now. This has coincided with the development of electronic computers, and the interaction of ideas has been fruitful.

After admiring video of a general purpose robot with a vision system informing a towel folding program, this section in the "Present and Future" chapter (ch. 10, page 220) caught my eye:
    This is where we are, in 1987, in the step-by-step analysis of the visual path. In terms of numbers of synapses (perhaps eight or ten) and complexity of transformations, it may seem a long way from the rods and cones in the retina to areas MT or visual area 2 in the cortex, but it is surely a far longer way from such processes as orientation tuning, end-stopping, disparity tuning, or color opponency to the recognition of any of the shapes that we perceive in our everyday life. We are far from understanding the perception of objects, even such comparatively simple ones as a circle, a triangle, or the letter A--indeed, we are far from even being able to come up with plausible hypotheses.
    We should not be particularly surprised or disconcerted over our relative ignorance in the face of such mysteries. Those who work in the field of artificial intelligence (AI) cannot design a machine that begins to rival the brain at carrying out such special tasks as processing the written work, driving a car along a road, or distinguishing faces. They have, however, shown that the theoretical difficulties in accomplishing any of these tasks are formidable. It is not that the difficulties cannot be solved--the brain clearly has solved them--but rather that the methods the brain applies cannot be simple: in the lingo of AI, the problems are "nontrivial". So the brain solves nontrivial problems.

The understanding of lower (neuronal) level sensory processing in animals has served as inspiration for many image processing techniques and algorithms, including scale space techniques and feature detection/description tools like SIFT.