Kara Finite State Machine

Kara Home Page Finite State Machine Automata Theory

Kara provides an introduction to programming through finite state machines. Kara's world is a grid of squares on which a small range of objects may be placed while Kara him/herself is a ladybug that moves around the grid and acts on the program's instructions. The program does not include commands in the sense of a high level language such as C or Pascal but rather a series of instructions based on the inputs from the grid and the next state in the program.

Examples

Getting Started with Kara Kara and the Clover Leaves Follow Trees
Tunnel Seeker 1 Tunnel Seeker 2 Searching for Clover Leaves 1
Searching for Clover Leaves 2 Searching for Clover Leaves 3 Searching for Clover Leaves 4
Maze 1 Maze 2 Pacman 1
Pacman 2 Own Programs  

Kara's world consists of a grid of squares with a small number of objects that can be placed in them. Kara reacts to the objects in the squares and can be programmed to take a variety of actions. Apart from Kara the world may include tree stumps, toadstools and leaves. The actions that Kara can take are: picking up a leaf, dropping a leaf, moving forward one square and turning either left or right.

When Kara is programmed the programmer can choose one or more states from a list of five supplied. To add a condition from the 'sensor library' the programmer simply double-clicks on the condition or drags it into the Used Sensor window:

The program then evaluates the combinations of conditions dragged into the Used sensors window.

When running the example programs the documentation provides trial environments and finished code:

Click on the 'Show program' bar to load the code into the 'Programming Kara' window.

Assignments

  1. Write a Kara program where Kara walks up to a tree and stops.
  2. Write a Kara program where Kara walks around a tree and stops when she finds (and eats) a leaf.
  3. Write a Kara program where Kara walks around a group of trees and stops when she finds (and eats) a leaf.
  4. Write a Kara program where Kara walks through a maze of trees leaving a trail of leaves behind her. Kara stops when she meets a mushroom.
  5. Write a Kara program that identifies a pattern such as space-leaf-space or leaf-mushroom-leaf (or any expansion of these).
  6. Write a Kara program where Kara walks around a terrain and stops when she finds and eats a leaf.
  7. Write a Kara program where Kara walks around trees as if in a slalom, left then right, round the end and back, endlessly.
  8. Write a Kara program that simulates the movements of an ant. If Kara is on a blank square then she removes the leaf and turns right and forward; if Kara is on a leaf she blanks the square and moves left and forward. Run this on a large grid at high speed to see if a pattern develops. Try two steps forward for the left movement.

Independent Study

Look at further problems in the Turing Kara guide:

Kara Home