Transcription of CHAPTER 18 Programming Your App to Make …
{{id}} {{{paragraph}}}
Figure 18 Programming your App to Make Decisions:Conditional BlocksComputers, even small ones like the phone inyour pocket, are good at performing millions ofoperations in a single second. Even moreimpressively, they can also make decisions basedon the data in their memory banks and logicspecified by the programmer. This decision-makingcapability is probably the key ingredient of whatpeople think of as artificial intelligence, and it sdefinitely a very important part of creating smart,interesting apps! In this CHAPTER , we ll explore how to build this decision-making logic intoyour 18-2. An event handler thattests for a condition and branchesaccordinglyChapter 14 discusses how an app s behavior isdefined by a set of event handlers. Each eventhandler executes specific functions in responseto a particular event. The response need not be alinear sequence of functions, however; you canspecify that some functions be performed onlyunder certain conditions. For example, a gameapp might check if a player s score has reached100, or a location-aware app might ask if thephone is within the boundaries of somebuilding.
Figure 18-1. CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks Computers, even small ones like the phone in …
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}