Sunday, September 11, 2005

Artificial Intelligence

This has been a pet project of mine for a long time.  Simply put, JSe AI:  Taxonomy is a program that can learn.  At the moment, it is somewhat human in that sometimes it "learns" new pathways and completely forgets old ones.  (It is a glitch that popped up between the two methods I developed to 'teach' the thing.)
-r
PS:
I've actually put in the effort to make this program "compatible" with msie.  I have NO PROOF, however, that it will actually function on that nonstandard shitty (though popular) browser.  If it does, please leave a comment telling me as much.

PPS:
There are two aux. functions:  The first is that you can make the program display code for what it has learned — it basically spits out its object database (js: object, perl/php: hash, anyone else: associative array).  If my website supported database functionality (to say nothing of cgi), I'd make this sucker more permanent.  For now, if you close the browser or hit 'refresh' it forgets everything you've taught it and reverts back to the 35-or-so I taught it before I uploaded it to my isp.  Enjoy!

<edit>
I had to fix the pre-defined list… What happened was I was making it learn taxonomy of ALL OBJECTS and then I decided to scale back down (to just life-forms) because some of the questions got weird and the AI's guesses got weirder (it would guess Beatles' 1969 White Album for 'Is it white?'
The easiest thing to do was to delete the mountains and islands and classic music and then manually edit the object inheritance list.  *sighs* but I did it, so that's what this edit is about.  Thanks for viewing!
<edit>
I have just finished fixing the last (small) bug (it correctly remembered things, but asked people to compare their new animal to the wrong one.  It is a little complicated to explain the problem, but I fixed it.  I then cut out the majority of the JS from the .dhtml file and put it into two .js files inside the js/ai subfolder.  In other news:  I may be teaching next semister at the nearby community college.  I suggested (jokingly) today that I could teach AI modeling.  But the more I think about it, I probably should suggest a class on programming aiming toward thinking machines (the ultimate programming assignment, if you ask me).  But I made 3 suggestion (didn't I?) already and perhaps I can superimpose (or juxtapose!!!!) ai into one of the programming classes.  Anyway:  for the record this is my version of the taxonomy AI model.  The computer asks you questions about an animal (or whatever) you're thinking of until it thinks it has enough information to guess your animal.  If it is wrong, you tell it the animal you really were thinking of and then you input a yes/no question to distinguish your animal from the pack (it'll ask you specifically which animal to compare to, actually) then it'll show— your_animal: Your question?—and you answer by clicking the yes or no button appropriate to answer your question — IMPORTANT:  You can ask either type of question:  Yes questinos are in no way preferred to No questions.

Enjoy!-=-

Monday, August 29, 2005

Hangman anyone?

This is the hangman game I cooked up after watching M 'study' with a 'web' version of the game for her bio psych class. It has 30 bio/psych words (actually they're words from her word list, not the book or whatever).

Enjoy.
-r
PS:
The thingy that randomizes the array necessitated uploading string and card functions.
-=-

Tuesday, August 23, 2005

The Blind Watchmaker by Richard Dawkins

http://r.wesley.edwards.net/code/watchmakers_shakespeare.html

This isn't really an "official release," but I was reading Richard Dawkins's The Blind Watchmaker and between pages 46 and 50 (or so) he is discussing the old adage about a million monkeys with a million typewriters and their probability of producing the works of Shakespeare, etc.

I tried to duplicate the simulation he was describing.  I may have failed, but it seems to work.  Most expressions take around 50 generations.
-r
PS:
I'll probably make it so a person can use whatever expression they'd like.  For now, it uses the suggested expression "METHINKS IT IS LIKE A WEASEL."

What the program does is it simulates a monkey at a specialized typewriter — it only has capital letters and the space bar.  Given a certain amount of complexity (letters in the sentence) and time (generations — by 'generations,' I mean "generations wherein there is a mutation") … (Ya really oughta read the book.)
-=-

Wednesday, August 17, 2005

JSeAF: Air Command

It turns out, this game can only be played using a computer. Normally, it seems, I pick an existing game and program it as a tool to keep myself sharp as a programmer and just as a challenge, etc. Sometimes, the nature of my brain, causes me to create games (like, 3 -or so- years ago, Knight's Gambit…)
I've been using my card library functions to create a few games, in fact. One of them involves the nature of 7s and was inspired by a solitaire game I saw once (when I remember the product name, I'll add it here). I called that game 'Sigma 7s.' …I have to complete it; at the moment, I'm letting it simmer and being braindead about it's small problem of running out of cards without warning (other than the errors the javascript console throws).

One day a few weeks ago, I suddenly realized that with a full deck of cards, jokers included, you had the possibility of filling a 9x6 square. If, I reasoned, each card's value had meaning in this new 2d space, a person could create a board game that would be as random as your ability to shuffle the cards. This is what I started with.

After designing the game board and making water regions (there is no difference between the water and non-water regions at the moment) and writing in all the CSS (I like making the background color change when the mouse is over a section of the board) … it occured to me that I had a static layout of 54 cards and there wasn't anything going on. I was tempted, of course, to program the game 'memory' — I may still… But, returning to the idea of a board-game and that each card's value has a meaning, I needed to create a game piece, a 'you.'

Somewhere in there, I decided that people would pick a color, red or black. I created two game pieces, using an upside-down 'v' and an 'x' (alien helicopter?) and some blur effect that I hope makes it seem like the roters are spinning. One of these was red and the other was black. Later, I decided a person could 'opt-out' and have no color and I created a 'clear' version. That is how we got 3 difficulty levels.

Easy: You pick a suit and an alignment. That is, if you pick Diamonds, you also pick Red. Now the Diamonds are your countrymen (or countrywomen) and the Hearts (also red) are your allies. The mission is to destroy enemy bases (cards marked King)! — Thus aligned, you must destroy the King of Spades and the King of Clubs. Only two objectives! Anti-aircraft launch sites are represented by Aces. If you are aligned, you only have two Aces using you for target practice, in this example, the Ace of Clubs and the Ace of Spades.

Medium: You pick a suit and leave the checkbox for color unchecked. Now your country has no allies. Just like above, you have to destroy the enemy bases (the cards marked King) — Only now there are three enemies: If you select Diamonds, your enemies are represented by cards marked King of Spades, King of Hearts and the King of Clubs. Naturally the anti-aircraft forces taking aim at you are also increased: All Aces except the Ace of Diamonds will attempt to knock you out of the sky, 3 of them in this example: Ace of Spades, Ace of Hearts and the Ace of Clubs.

'tain't dareHard/Difficult: If you choose 'None' for your suit you aren't given the opportunity to choose an alignment (because there is none for 'clear') and so you have 4 bases (all the Kings) to destroy and 4 Anti-aircraft launch sites to avoid. This situation is VERY difficult and I, personally, have never been able to win using this configuration.
-r
But wait! I always had a setting for missiles. I originally was thinking of having other players flying around but I decided that'd make it too complicated (for the players, not for me in terms of programming) and possibly even annoying as well. If you view the source, you'll see that the missiles are called 'air2air,' still. I was going to remove the thing and suddenly decided to make them guided missiles for anti-aircraft sites. At first, as you can see, if you do view the source, I was going to make it so if you triggered the missile system, it would require you to set a direction for your missile. If you selected the middle (it was a 3x3 square, representing the 8 directions and 'your aircraft' in the middle) — if you selected the middle, it would activate a computer-guided system. I decided all this was too much and that I liked the computer guided system best anyway. Now, as long as you have missiles available, you can attempt to deploy them.

If an anti-aircraft launch site can target you, the computer-guided system can target it. Your aircraft is still at risk, but you don't have to be directly above an anti-aircraft site and bomb it if you want to dispose of an attacker (very hazardous). If the first missile fired at an anti-aircraft site misses, the second missile will try it, with less chance of success. It is possible to destroy four anti-aircraft launch sites with one volley, but in each case the first one would have to be successful — this has a probability of about one in two.

Anyway: Enjoy!



http://r.wesley.edwards.net/code/card_game/war_game_dhtml.htm
(most likely won't work with internet explorer)

PPS:

Contrary to the above dialog box from the game, I have never won on the difficult setting of picking no flag or alignment. I was able to "win" only because I had Enabled missiles.
-=-

Sunday, July 24, 2005

JSE Card Game Template [Go Fish]

config screen

Some time ago, I wrote a Javascript card game which was Go Fish, at least as I learned it when I was growing up.
-r

PS: I have since then learned that the real rules of Go Fish involve books of all four suits for each card, and other things that I had no idea of.
I learned this after I programmed
my version and I was looking for the rules online so I could "creatively borrow them."

To be fair, I would have said something like, "according to Yahoo Games, the rules for Go Fish are as follows..."

Unfortunately, every online source I found played Go Fish differently than I always have. So I guess my game is Go Fish for Morons. Or Go Fish Lite. Too bad.
But at least I didn't think I'd programmed, "GO FISH++" (
Go Fish Plus Plus).

Anyway, here're a couple screenshots, I use Mozilla's Firefox browser (it is standards compliant and I can use the TOOLS/Javascript Console to debug) and I used Alt+PrtSc to capture the Firefox window…
That program running in the top is called Beatnik. It keeps the clock set for me and allows me to format the date correctly. Google it.

*WINKS*

As usual, please play the game… and tell me what you think.

Thanks in advance.


PPS: See game in progress screen shot below…game in progress
-=-

Tuesday, July 19, 2005

Hot as hades...

It is very damn hot here.
I've offered to help Ben with his boycott Chinese made goods blog.
God it's hot. My head is fried. At least our a/c works. I think I'm going to ambush my friend ZombieSlayer at home and steal some of his (and his wife's) icecream.
FUCKIN' HELL IT IS HOT.
how can people live like this?
-r
PS:
It was 110 today and it was 110 yesterday too.
We moved over 500 miles North and UP THE MOUNTAIN a bit...and it didn't get colder; it got hotter.
If this is punishment from God, what the fuck did I do?
-=-

Friday, May 13, 2005

KDE Fever

Up all night configuring and customizing KDE / Mandrake on gf's computer. Thought I'd drop a line, better'n do'n a line. ... (but I wouldn't know, I guess).

Hey, JSe is workin' on a ton of javascript games that are suitably geared for compatible browsers. If anyone's interested...

-r
PS: I'd love it if someone'd play MCG (I'm sorry, Knight's Gambit... yeah, yeah) with me.
It works remotely, make a move then encode for remote play, post move, email it, whatever.

http://r.wesley.edwards.net/games/
Ya'all'll have to be my cheap AI, until I figure out how they programmed big blue to play chess and beat whashisname. What is his name, anyway? ...and when was that?
O.k., back to my configs. and, hey: play the game. ;)
-=-