Calculating chances
Now that we have everything set, we are ready to input all of this information into our code. We'll be using Booleans to define the main goals and then we'll create statements that will make the character AI choose between all of the other options. We already defined the primary statement that will switch our goal from defeating the player to simply surviving, but now we'll be adding more details to our AI behavior because of this question; What happens if the enemy has enough HP to confront the player but doesn't have enough bullets? What if he has enough bullets but his previous attempts to shoot the target have failed? The character will need to prioritize his choices and for each choice that they will be making, they ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access