Last Good Quote: Son's are the seasoning on our lives. - Someone on Facebook

Friday, March 12

Artificial Intelligence - Motors


So, we defined how the Ai will monitor and sense the world, how will it interact with it?

This happens almost in the reverse of what happens with sensors.

This time we start with the Motor Stack. The Ai places some data and a motor ID on the stack. As it “thinks” about additional task it keeps adding stuff to the stack.

Motors will continually do the same thing.
  • Look on the stack for an action with their identifier.
  • Take the data and perform their action.
  • Repeat.
What can a motor do? Anything. The simplest of motors may be responsible for taking text and putting it in a textbox for a user to see. A more complex motor may take an filename and display the contents of the file to a user. An even more complex motor may take a formula and graph it over time, sort of like your old T1 calculator.

Wednesday, March 10

Artificial Intelligence - Sensors


Sensors

So without senses we, humans, would not be able to function. Much less be considered “intelligent”.

In the same fashion our Ai needs a way to sense changes in it’s environment.

Think of a sensor, as a program that sits outside of the Ai brain. They monitor the environment and then pass data from those changes to the brain. So, the Ai will have a number of these sensors that will monitor the environment. T

How it works:

Step 1: Some change takes place within the environment of the Ai. For Example: A text box has “Hi” typed into it.

Step 2: The sensor detects the change and gathers the data. For Example: “Hi” is saved as data

Step 3: The sensor sends the data into the Ai. This is where the data crosses into the Ai’s brain.

Step 4: The Ai, takes the raw data and the sensor ID and puts in on the bottom of the sensor stack. The sensor stack is a “list”/stack of data which the Ai has done nothing with yet.

Some Points to Ponder:

Sensor ID: Each sensor must have a unique identifier. This is essential for the Ai as it will learn to do different things with this sensor’s data. Now just because the sensor ID is constant does not mean the sensor has to watch the same point in the environment. In the above example, the sensor could go from textbox to textbox taking in the data.

Sensor Stack: The sensor stack has all data points from the sensors which the Ai has not processed yet. This is critical as the Ai may let data stack up till it all make sense to it.

The next post will discuss how the Ai will use the stack to decide on actions.

Tuesday, March 9

Artificial Intelligence - Take One

The next few posts will be about a proposal for an Artificial Intelligence (Ai) system. It’s based on many things I’ve read around the internet as well as my own general ideas on how such a system needs to be made.

My goal is to detail the system in a few articles and then attempt to build it. If given time, a thing I have precious little of these days.




This shows the basic concept of the AI. As you can see it’s made up of 4 components. We will talk about each component in depth but from a high level you have:

Sensors – Track and record changes in the environment. This would be the point at which data enters the Ai’s consciousness. An Example: A sensor may be responsible for tracking a single text box on a given web page.

The Brain – This is where all the interesting stuff takes place, stay tuned. An Example: The brain may decide that in response to text entered it should display a picture.

Motors – The brain will issue simple commands which the motors will execute on. Motors will perform actions on the environment. An Example: A motor may be responsible for displaying a picture to a webpage.

Memory – Pieces of data and how the brain acted upon this data are stored in memory. Later on I will go further in depth with what will happen here. An Example: The word “Hi” might be stored in memory as well as the fact that the brain responded “Hi” back to it.

Some things to keep in mind:
This is an all-purpose form of intelligence, it’s not what many would consider a knowledge based system, or built to be superb in a specific category. In fact, I predict that this brain will not be superb at anything, but rather much like the majority of humans, it will be sufficient at being adequately productive.

My goal is to build an Ai which can function in the same capacity as an average human. Think of the Turing test but including tasks rather than chat.

My measure of success: If the program can return/perform in such a fashion that I can’t tell the difference between it and a human, I will have succeeded.

Saturday, January 30

iPad and the Future of Computing

I believe that the Apple iPad represents the next step in the future of computing. A trite and often spoken phrase, but let me explain.

Right now, laptops, phones and pdas are all viewed as tools. When I want to do something "online", I go looking for my computer. The future is when using a computer or getting on the internet becomes as frequent and often as watching TV, listening to the radio or opening my fridge. It needs to become a thing that is a given, always there, always available and everyone has one. The iPad changes this by bring a computer within price range of the all Americans. This is said with the assumption that after the first year of release the price will half, like most other technical products.

The iPad also lowers the barrier to use. Humans have an odd trait that 80% of the time we will use the tool easiest available or soonest available rather than the best tool for the job. What ever tool has the least barrier to usage, becomes the one we use by choice.

Today, when I want to get online I have to go "find" and "turn on" a computer. Even if that action is as simple as opening a device and logging in. The iPad takes another step toward changing this. Here is a device that is always on, doesn't have to be "opened" and is more "available" then other internet connected device. (Excluding smart phones). It's light enough and small enough that I can leave it anywhere, my bed, the bathroom, the kitchen, the car...it can just be with me as I roam my life.

Removing the keyboard as an essential part of the computer experience is a huge step. Apple started it with the iPhone and if they can truly enable keyboard less computing, it will dynamically change the way we use computers.

A note, I think netbooks set the stage for the iPad but I never felt that they were really the next step, they made computers cheaper but at the cost of quality. A good thing, but not necessarily an advancement in technology.

Friday, January 29

A Test in AI

I've been doing a lot of reading up on AI and I got to thinking...

Question: Is it possible to "grow" code that acts in an intelligent fashion?

So, I thought I'd walk a little test and see "what happens". However I have a "goal" that at some point watching these bots interact together should be 'interesting'.

I started with a map, a bot and a set of actions that the bot can perform.

Map:
  • 20 x 20 square
  • Going off one side of the map brings the bot to the other side of the map. (much like pacman)
Available Actions:
  • Move Up one square
  • Move Down
  • Move Left
  • Move Right
  • Look Left returns true if another bot is to the immediate left
  • Look Right
  • Look Up
  • Look Down
  • If(a, b, c)

  • a, b c - can be replaced by any other action except if
  • if a is true then b will be performed
  • if a is not true then c will be performed
  • Fight - Kills any bot within one square
  • Breed - See below
An example bot:

(This bot moves in a circle attempts to fight, then breed then it runs south)
0: Move("E")
1: Move("N")
2: Move("S")
3: Move("W")
4: Fight()
5: Breed()
6: Move("S")
7: Move("S")
8: Move("S")
9: Move("S")


How they Grow
Populate the map with 20 bots. Each of them selects 10 random actions from the list above. They then perform the actions in sequence. We are looking for some type of intelligent behavior from these bots.

Breeding
Breeding is the key to the bots learning something. Any time a bot attempts to breed the following sequence takes place:
  1. Look for another bot within 1 square
  2. 5 times, take a random code from this bot and replace it with a random code from the other bot.
  3. Find a bot that is dead and has a lower score than either parent bot.
  4. Give the new code to this bot.

The primary bot, sometimes called father, is the bot that started looking to breed. (Hey, I'm a dude what can I say.)

The secondary bot, sometimes called the mother, is the bot that was found close by. (Sorry ladies)

Gross huh? or Cool, depends on how you look at it.

The other form of breeding could take place after the bot is dead for a given number of turns. When this is the case, the bots code is randomly mixed with random code and the bot is set alive again.


Scoring

So, I needed a way to identify "good" behavior. I'm still on the fence if I can call it intelligent behavior. Either way, this is how I scored each bot.
  • +1 for Killing another bot (Survival of the fittest)
  • +1 for Breeding (father)
  • +1 for Help Breeding (mother)
  • +.25 for each tick that the bot stayed alive
Keep in mind that during breeding a bot can only breed if there is a dead bot of a lesser score on the board. This keeps a "dumb" breeder from taking over the board.

Other Notes

Age - Keeps track of the number of times the bot's code was "messed with"

Kids - Number of successful breeding attempts

Parents - The last two parent bots of the current bot.

Bots will block each others path, unless dead.

When a bot is re-spawn or the child of another bot, they are respawned at a random location on the map.

What's happening?
OK, so I ran the simulation with the following parameters:
  • 1,000 iterations (steps)
  • 20 Bots
  • Respawn after 20 seconds
  • +1 for Killing another bot (Survival of the fittest)
  • +1 for Breeding (father)
  • +1 for Help Breeding (mother)
  • +.25 for each tick that the bot stayed alive
These were the top 3:

Bot 12: 5 iterations, 18 kills, 1 kid, score: 248

This bot tried to fight, breed then moved east a little and tried over
  • 0: fight([BOT_ID])
  • 1: look('S', [BOT_ID])
  • 2: fight([BOT_ID])
  • 3: look('S', [BOT_ID])
  • 4: fight([BOT_ID])
  • 5: look('S', [BOT_ID])
  • 6: findMate([BOT_ID])
  • 7: move('E', [BOT_ID])
  • 8: move('E', [BOT_ID])
  • 9: fight([BOT_ID])
Bot 19: 2 iterations, 10 kills, 4 kids, score: 260
This bot moved diagonal across the board mating and fighting as it went. Died a lot while I was watching.
  • 0: look('E', [BOT_ID])
  • 1: fight([BOT_ID])
  • 2: move('N', [BOT_ID])
  • 3: findMate([BOT_ID])
  • 4: move('W', [BOT_ID])
  • 5: look('S', [BOT_ID])
  • 6: look('N', [BOT_ID])
  • 7: fight([BOT_ID])
  • 8: move('W', [BOT_ID])
  • 9: look('N', [BOT_ID])
Note: During this round the bot with the most code changes (13) had the following line of code:
5: ifOnly(look('S', [BOT_ID]),"move('S', [BOT_ID])","move('W', [BOT_ID])", [BOT_ID])
6: fight([BOT_ID])

Intelligence? He looks south if he sees something he moves south and then attacks. Otherwise he moves west.
Bot 12: 5 iterations, 13 kills, 1 kid, score: 230Very similar to the first test. This bot tried to fight, breed then moved east a little and tried over
  • 0: fight([BOT_ID])
  • 1: findMate([BOT_ID])
  • 2: look('S', [BOT_ID])
  • 3: look('S', [BOT_ID])
  • 4: look('S', [BOT_ID])
  • 5: look('N', [BOT_ID])
  • 6: findMate([BOT_ID])
  • 7: look('N', [BOT_ID])
  • 8: move('E', [BOT_ID])
  • 9: findMate([BOT_ID])
Bot 15: 4 iterations, 13 kills, 1 kid, score: 249
Moved a little differently, but overall moved east...a pattern might be emerging.
  • 0: ifOnly(look('E', [BOT_ID]),"findMate([BOT_ID])","look('E', [BOT_ID])", [BOT_ID])
  • 1: move('E', [BOT_ID])
  • 2: fight([BOT_ID])
  • 5: fight([BOT_ID])
  • 6: move('W', [BOT_ID])
  • 7: move('E', [BOT_ID])
Bot 7: 4 iterations, 27kills, 0 kid, score: 262
Very efficent use of code, notice how he spawned to kids to compete with him. Thus giving him the high score.

  • 0: fight([BOT_ID])
  • 1: move('N', [BOT_ID])
  • 2: move('S', [BOT_ID])
  • 3: findMate([BOT_ID])
  • 4: ifOnly(move('S', [BOT_ID]),"fight([BOT_ID])","fight([BOT_ID])", [BOT_ID])
  • 5: ifOnly(move('S', [BOT_ID]),"move('E', [BOT_ID])","look('N', [BOT_ID])", [BOT_ID])
  • 6: move('N', [BOT_ID])
  • 7: fight([BOT_ID])
  • 8: look('N', [BOT_ID])
  • 9: move('W', [BOT_ID])

Thursday, January 28

CSS Tip - Center a Div

For those that may not know...

To center a div with CSS...do the following:

#content {
width: 700px ;
margin-left: auto ;
margin-right: auto ;
}



Width must be specified.


Now if only I could center a div that has an absolute positioning

What is RAM?

So the Hot One, my wife, comes to me the other day with a flyer in her hand..."Is this laptop a bargin?"

"Sure, but you'll need more Ram", I said.

"Why" says the 10 year old.

"It'll run faster", I answered.

Now, what most people want to know is "How much do I need", here is the short answer: 3GB.

And here is the long answer. Most people may vaguly remember that RAM is memory. However, I like to think of it as the ability for a computer to multi-task.

The more RAM a computer has the better it will be at multi-tasking. You see, each program and application you open will request an amount of RAM for its own exclusive use. This is ok, but at some point the computer has no more to give. Now, being a good tool, the machine does not stop working, but it does start running slower. And as you keep opening windows it will get slower and slower.

So in conclusion, the more RAM you have the "things" you can do with your machine without affecting the speed.

Like all rules, this one has an exception. Some programs when they load, go ahead and take up all available RAM. You know who these greedy beast are before you even fire them up...cause usually they are the only thing you have open. Examples would be: 3D games, Virtual Boxes and Development environments.

The other time that RAM really comes into play is on start up. The computer needs to start a million things at once...to speed this up it constantly swaps part of the programs being started into and out of memory. The more memory you have the more it can switch and swap.

Here's a quiz for you... What can you do to speed up your machine, without spending money on new "hardware"?

By the Way: Join me in Charlotte, Feb 6th for the Annual HSCC Open House. We're teaching kids how to build Java websites this year. More Info at bdpa-charlotte.org

Thursday, January 14

Today is Special




A little wiser and a little smarter.

I did a little artwork for myself...couldn't sleep last night.

Thursday, January 7

Why Flash is Not a PBBG

A lot of folks ask me what "games" I develop. I tell them I make Persistent Browser Based Games (PBBG), their eyes promptly gloss over and I promptly move along.

However, there are some few folks who know what I'm talking about. This post would be for those select few.

Flash games are not Persistent Browser Based Games.

A PBBG is the defined as the following (from pbbg.org)
A persistent browser-based game, or PBBG, is a computer game that satisfies the following two criteria:
  1. It is browser-based. The game is played over the Internet using only a web browser.
  2. It is persistent. Progress in the game is achieved over multiple playing sessions.
PBBGs merge the depth and longevity of an application-based game with the accessibility and portability of a browser-based game. PBBG can be spoken as pee-bee for brevity.
Notice the explicit use of the word only .

Flash requires a plug-in, regardless of which browser a user uses. Thus it is out. Even if the game itself is "persistent". Now, flash can be an added bonus/feature to your game. But if a user needs flash to play your game then its no longer a pbbg.

Flash stay in your genre or make your own.

Why is this important to me?
PBBG is a different art from flash development. I like the fact that PBBG development requires you to understand all the three levels of web development. It also assist you in growing skills that can be used in a more "professional" environment.

Flash on the other hand, can more easily blur the lines in the three levels of web development as well as cut some corners on some fundumental development skills that professionals need.

If someone comes to me and says I've developed a PBBG...I can assess thier skill set pretty quickly. If someone says they've done a Flash game...well...I know a lot of easy ways to throw a flash game together.

Is it important to you that Flash games be excluded from PBBGs?

Tuesday, January 5

5 Interesting Sites for the Creativity Seeker

Innovative
This site takes my breath away. Creative, beautiful and entertaining. It's not about a whole lot but still shows the power of what you can do with the web.
Expirements in Javascript
Click on one of the links, this guy has a bunch of experiments in Javascript and flash. Interesting stuff to play with and see just what you can do with Javascript.
Photoshop Tutorial Playground
Whenever I visit this site I always find something new to try and play with on my own. It's a list of links to tutorials on photoshop and image manipulations, but let yourself wander through the sites, they are all pretty good.
DIY Wonders
Wonderful things you can create all by yourself with a little ingenuity and creativity. Some technical related, some just fun to do. Again, I never fail to find something to try after reading this page.

I have an "Inspirational" and "Interesting" folder link, these sites sit in there. From time to time I bring up the folder and go visiting. Especially when I'm bored.

Where do you visit to kill time? (Excluding game sites, we all know how to find those.)

Followers