Natural selection is the algorithm Nature uses to maximize the probability of reproduction of organisms. With Genetic Algorithms (GAs), engineers imitate this process in order to optimize a set of parameters in an engineering problem… or a dune buggy! The great application at boxcar2d.com uses simulated physics to evolve 2D cars that are optimally fast [...]
Recently a friend of mine introduced me to a game called Set. Set is a logic cards game for several players; 3-5 players is probably best, but in there is no limit in principle, and it is also fun to play as a solitary. The game contains a deck of cards with symbols varying across [...]
Posted on September 10, 2010, 10:13 pm, by pietro.
As another scientific Python course is approaching, I’ve been brushing up my PacMan skills. I decided to give a try to a strategy I had been thinking on, which relies upon having a good estimate of the enemy’s position. I should remind the reader that in the PacMan capture-the-flag game, one team does not know [...]
Posted on September 12, 2009, 12:55 pm, by pietro.
At the beginning of September I’ve been invited to teach at a summer school about scientific programming. The whole experience has been really rewarding, but it was the student’s project that got me going: we had the students write artificial intelligence algorithms for the agents of a PacMan-like game, and organized a tournament for them [...]
In the last post I discussed how it is possible to program a game Artificial Intelligence to exploit a player’s unconscious biases using a simple mathematical model. In the karate game above, the AI uses that model in order to do the largest amount of damage. Give [...]
I regularly read about people complaining that AI in games should be improved. I definitely agree with them, but here’s a argument why pushing it to the limits might not be such a good idea: computers can easily discover and exploit our unconscious biases. Magic? ESP? More like a simple application of decision theory. In [...]
I wrote a simple game to learn how to store on and retrieve data from a server-side database. The rules are simple: you have to guess 2/3 of the average of the guesses of all the players. So, for example, if you think that the other players guessed on average 100, your guess should be [...]
Here’s another classic from the 80′s: an artificial life simulation, where bugs move on a virtual Petri dish, hunting for bacteria. If they manage to survive until adulthood, and accumulate enough energy from bacteria, the bugs reproduce and generate two copies of themselves. In the reproduction process, the genetic code undergoes small mutations, so that [...]
In games and other graphical applications one has to keep track multiple sprites and detect collisions between them. A naif approach would loop over all sprites and check for collision with *every other sprite*. This is, of course, terribly inefficient and can be very slow even for a small number of sprites. One way out [...]
I decided to get my feet wet with Flash + ActionScript programming with a classic of the 80′s: 2-dimensional Cellular Automata! A 2D CA is a grid of cells, each of which can be in either an “alive” or “dead” state. The state of each cell evolves in time, according to simple update rules based [...]