10
        It's now time to teach the turtle all that we have worked out. I hope you've written down those ten numbers that you went to so much trouble to find.
     We've already done the picture stuff in the first Noughts and Crosses project. So make a copy of that project and delete what we no longer need:
    
    to startup
      clear
    end

    to clear
      everyone [setshape "blank]
      make "last pick [cross nought]
    end

    to ox
      if shape = "blank [
        if :last = "cross [setshape "nought]
        if :last = "nought [setshape "cross]
        make "last shape
      ]
    end
    
    

Try to think what steps we need to add before reading on.
    
    to startup
      clear
    end

    to clear
      everyone [setshape "blank]
    end

    to ox
      if shape = "blank [
        do a cross (the human has clicked on a square)
        work out the best move for the turtle and make it
      ]
    end
    
    
Pretty easy huh?
HOME table of contents previous next