Chapter    6

Making Smart Decisions

NXT-G gives you the ability to program a robot that can evaluate conditions and values that are presented to it. It allows your robot to make choices based on these values; whether it makes smart choices is up to you. Using the tools that are available, you can program your robot to better navigate and solve tasks by “thinking” for itself instead of being hard-coded in what it will do when it hits the game field. Smart robots are winning robots.

Switch Block

The Switch block is found on the Flow palette and by default is set to evaluate the values of a Touch sensor, but it can be used for much more complex evaluations as well, including values of variables. Figure 6-1 shows the Switch block in its default ...

Get Winning LEGO MINDSTORMS Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.