WeatherKarel
—Tyler Shultz

In this program Karel learns how to predict the weather based on yesterday’s weather condition and a piece of sea weed

Karel’s learning curve can be observed by watching the green and red markers grow on the eastern wall of Karel’s world

This program has 5 main components:

  1. it generates a current weather condition (sunny, cloudy, or rainy) based on yesterday’s weather condition, the probabilities of this are found in a predetermined probability matrix
  2. this weather condition changes the state of Karel’s piece of sea weed based on a predetermined probability matrix these states are dry (light gray), damp (dark gray), wet (green), or soggy (black)
  3. Karel looks at what the weather was yesterday and her piece of sea weed and guesses what today's weather will be by finding the maximum value of

    P(today’s weather condition|sea weed state)

    by finding the largest value of

    P(sea weed condition|today’s weather condition) * P(today’s weather condition|yesterday’s condition)

    eg, if sea weed is dry and it was cloudy yesterday, Karel finds the maximum value of:

    P(sunny|dry) = P(dry|sunny) * P(sunny|cloudy)
    P(cloudy|dry) = P(dry|cloudy) * P(cloudy|cloudy)
    P(rainy|dry) = P(dry|rainy) * P(rainy|cloudy)

  4. Karel compares her guess to the actual weather and records it by marking a red corner if she is wrong or a green corner if she is correct
  5. Karel sees the weather today, the weather yesterday, and the state of her sea weed and stores this information in two matrices. Over the long term, this process allows Karel to reconstruct the predetermined probability matrices, and make more educated guesses in the future