This article describes about (game) artificial intelligence in Microsoft Small Basic programming language.

Artificial Intelligence

Artificial intelligence (AI) is a computer side tactics routine in game programs.  Game AI moves computers' pieces or characters.  A tic-tac-toe program MRB574 is an example which has some game AIs.


Heuristic is a solution method getting from discovery or experience.  The tic-tac-toe program above has heuristic game AIs named RANDOM, CENTER, RUNORSTOP.  These AIs have following features.

  • RANDOM - follows only the rule of the game
  • CENTER - put the first move to center and other moves are the same as RANDOM 
  • RUNORSTOP - makes three in a row first, stops enemy's three in a row next

Game Tree Search

Another tic-tac-toe program LBW762-13 has a game AI which searches a game tree.

Following picture shows a part of the game tree for the second tic-tac-toe program.  Every node of the tree means one game position.


Minimax is a basic method to search game trees.  The second tic-tac-toe program uses minimax.  It calculates score for every node (game position): +1 means X wins, -1 means O wins, 0 means draw.  X is max level player to maximize the score.  O is min level player to minimize the score.

A Connect Four program LSM678-6 also uses minimax algorithm.


For more complex games, the game trees become too large.  So, searching game trees is difficult for the games.  Go game is one of these games.  In many Go games AI does random simulation (called playout) many times to find a better move.  The first tic-tac-toe has an AI "MONTECARLO" to simulate many games to calculate which move wins better.  And AI program Go Simulator PTB804-2 shows just simulations.

Artificial Neural Network

AlphaGo is a strong Go program which has deep learning AI.  Deep learning learns games automatically with deep layers of artificial neural network (ANN).  Deep learning is one of machine learning method. The most significant feature of machine learning is that the AI logic is tuned by itself.  So programmers don't program the logic in the ANN.

There are no Small Basic programs that have this kind of AI so far.  But ANN itself can be simulated by simple Small Basic programs or ones with ANN extension.

See Also

Other Resources