13
    Now we need your table of scores - my numbers are silly numbers - I don't want to spoil your fun.
category 01234568912
score 12345678910
So we need a procedure that outputs a score for a category. Something like this:
    
    to score :category
      if :category = 0 [output 1]
      if :category = 1 [output 2]
      ...
    end
    
    
Make sure you use your scores not my silly ones!
Now we need a procedure to do all the scores and add them up:
    
    to total
      make "turtle who
      t1, make "v1 value
      t2, make "v2 value
      ...
      make "s score (:v1 + :v2 +:v3) ; row 1
      make "s :s + score (:v4 + :v5 +:v6) ; row 2
      ...
      talkto :turtle
      output :s
    end
    
    
The two red lines are to make sure we leave the turtle the way we found it. Well we are now ready to write the best_move procedure.
HOME table of contents previous next