Deciding whether Q*bert is above or below the snake is pretty easy - I just compared row numbers. But picking between the left and right was more of a challenge. Eventually, I came up with an expression:
leftRightCriteria = coilyRow-preyRow - 2*(coilyRowPos-preyRowPos)
I found that if this "leftRightCriteria" was less than zero, then Q*bert was to the left of Coily; if it was greater than zero, then Q*bert was to the right of Coily; if it was zero, Q*bert was directly above or below Coily. So now I could apply this to the decision tree.
No comments:
Post a Comment