# Machine Logic and Strategy

If you're serious about learning logic, there are many applications beyond these entertaining puzzles. In fact, you need not look any further than the device you're working on. Ultimately, all of the programming on your device boils down to processing hardware that implements logic in physical form.

Below are representations of 3 types of logic gates. They take two inputs, process these inputs in particular logical ways, and produce an output.

# Machine Logic and Strategy

The diagram below shows AND gates that take two inputs (from the left) that each produce one output (to the right).

AND gates will output 1 if both inputs are 1, otherwise they will output 0. (You can read "1" as equivalent to "true" and "0" as equivalent to "false".)

What will the output be at the question mark?

# Machine Logic and Strategy

XOR gates will output 0 if the inputs are the same, otherwise they will output 1. (XOR stands for "exclusive or"; essentially "return true if one and only one of the inputs is true.")

The three gates below are all XOR gates. The value A is used as input for two different gates. What is A?

Note: In gates like these only 1 or 0 are possible inputs and outputs. There is no third, or other, possible input/output. It may be the case that the diagram above is impossible.

# Machine Logic and Strategy

What is the output?

# Machine Logic and Strategy

Because computers just implement the logic they're programmed with, the hard part of making a computer AI (Artificial Intelligence) is knowing what strategies to program it to use so that it functions intelligently.

The last two questions of this quiz begin to explore how you might program a game on a smartphone or desktop computer so that it can always play optimally against any opponent at games like tic-tac-toe.

# Machine Logic and Strategy

Assume that you are playing a Tic-tac-toe game with an opponent. You are playing as $$X$$ while your opponent plays as $$O$$.

The game is played as follows:

Find all the possible grid tiles where you can put an $$X$$-mark that will help you guarantee yourself a win under best play.

# Machine Logic and Strategy

This game is similar to Tic-Tac-Toe except four consecutive Xs or Os win rather than just three. X is next to move and can make a move that guarantees a win even given best play by O (provided that X makes the right decisions afterwards). What column should X move in for the quickest route to victory?

# Machine Logic and Strategy

In later quizzes in this course, we'll discuss more games and strategies. In this course, although the puzzles start out simple, we will eventually play around within many different advanced branches of logic, including:

• Sets and Syllogisms
• Computer Logic Gates
• Formal Logic.

×