In a row: AND排成一排:AND
Watch all four rows of the table. In how many of them does the light turn on?
把真值表的四列都看一遍。有幾列燈會亮?
How Computers Work · Unit 1 · Lesson 3 · 電腦概論 單元一 第三課
Wire two switches in a row, side by side, or as a seesaw, and watch a light answer AND, OR, and NOT in 3D. Then connect gates to solve six everyday puzzles and test yourself on truth tables.
在 3D 裡把開關排成一排、一上一下,或做成蹺蹺板,看一盞燈怎麼回答「而且」「或者」「不是」。再把閘接起來解六個生活裡的題目,用真值表考考自己。
A computer decides by wiring switches together. Switches in a row answer AND, switches side by side answer OR, and a switch that works backward answers NOT. These logic gates take in 0s and 1s and give out a 0 or a 1, and gates joined to other gates can answer any yes-or-no question.
電腦做決定,靠的是把開關接在一起。排成一排的開關回答「而且」,一上一下的開關回答「或者」,反著做的開關回答「不是」。這些邏輯閘吃進 0 和 1、吐出一個 0 或 1;一個閘接一個閘,就能回答任何「是或不是」的問題。
3D Model · 3D 模型
A battery, a light, and switches on a board. Tap a switch to push its handle down: down means 1, up means 0. When there is a complete path of copper from the battery to the light and back, dots run along the wire and the light turns on. Choose AND, OR, or NOT to rewire the board, and watch which row of the truth table you are on.
木板上有一顆電池、一盞燈和幾個開關。點一下開關,把它的把手壓下去:壓下去是 1,翹起來是 0。只要從電池到燈、再回到電池有一條完整的銅線,線上就有光點在跑,燈也會亮。選 AND、OR 或 NOT 換一種接法,同時看看自己現在在真值表的哪一列。
Tap a switch · 點一下開關 Drag to turn · 拖曳旋轉 Scroll or pinch to zoom · 滾輪/雙指縮放
This 3D model needs WebGL, which this browser does not support. The A and B buttons and the truth table below still work, and so do the reading and the games.
這個瀏覽器不支援 WebGL,無法顯示 3D 模型;下面的 A、B 按鈕和真值表照樣能用,課文和小遊戲也都能用。
A teaching model. In a real computer nobody pushes the switches: each gate is built from a few transistors, which are switches turned on and off by electricity, and the output of one gate drives the inputs of others. Real gates are far too small to see, and they do not have copper arms or light bulbs. The dots only show that a path is complete; electric current is not a row of little balls. The logic is exact: every row of the truth tables matches what real AND, OR, and NOT gates do.
這是教學用的示意模型。真的電腦裡沒有人去壓開關:每個閘是用幾個電晶體做成的,電晶體是由電來控制開和關的開關,一個閘的輸出會去推動別的閘的輸入。真的閘小到看不見,也沒有銅臂和燈泡。光點只是表示「路通了」,電流並不是一排小球。邏輯是精確的:真值表的每一列,都和真的 AND、OR、NOT 閘一樣。
Model and code are drawn and programmed by My Culture Connect. The truth tables and puzzles are tested in tools/computers/test/logic.test.mjs.
模型與程式由人師教育協會自行繪製、撰寫;真值表與題目有自動測試(tools/computers/test/logic.test.mjs)。
Reading · 英文閱讀
Every day a computer makes countless small decisions. Your phone unlocks only if the passcode is right. A game ends if you run out of lives. A message goes out if you tap Send and you are online. But Lessons 1 and 2 showed that a computer holds nothing except switches and numbers. Nobody inside is thinking. So how can a pile of switches decide anything? The secret is in how the switches are wired together.
Start with a battery, a light, and two switches, A and B. Wire the switches in a row, one after the other. Now the current has to pass through both, so the light turns on only if A and B are both on. This arrangement is called an AND gate. Next, wire the two switches side by side, so that the current has two roads to choose from. Now the light turns on if A or B is on, or both. This is an OR gate.
The third kind is the simplest and the strangest. It has only one input, and its output is always the opposite. If the input is on, the output is off. If the input is off, the output is on. It is called a NOT gate, and in the model it is a switch built like a seesaw. AND, OR, and NOT are the three basic logic gates. Each one takes in 0s and 1s and gives out a single 0 or 1.
You can write down everything a gate does in a small chart called a truth table. It has one row for every possible set of inputs. Two inputs can be set in four ways, so the table for AND has four rows, and only the last row, 1 and 1, gives a 1. In a real computer, nobody flips the switches by hand. The gates are made of transistors, which are switches turned on and off by electricity. That is why the output of one gate can become the input of the next.
The idea is older than computers. In 1854, a largely self-taught English mathematician named George Boole published a book known as The Laws of Thought. He showed that logic could be worked out like algebra, with symbols and rules. His system is now called Boolean algebra, and it is the basis for designing computer circuits. Boole died in 1864, long before anyone built an electronic computer. Decades later, a student named Claude Shannon showed that Boole’s algebra fits circuits made of switches.
One gate answers one small question. The power comes from joining gates together. “Go out to play if it is NOT raining AND your homework is done” needs two gates: a NOT and an AND. Join more of them, and a circuit can compare two numbers, choose between two paths, or, as you will see in the next lesson, add. A modern chip holds billions of transistors wired into gates. Every decision a computer seems to make is really a great many tiny yes-or-no questions, answered by gates one after another.
Questions · 閱讀理解
How are the switches wired in an AND gate, and when does the light turn on?
What does a NOT gate do?
Why does it matter that the output of one gate can be the input of another?
Words & Phrases · 生字及片語
Quick Check · 小測驗
1. Two switches are wired in a row. When does the light turn on?
2. A is 1 and B is 0. What is A OR B?
3. What is NOT 1?
4. How many rows does a truth table need for a gate with two inputs?
5. According to the reading, what are the gates in a real computer made of?
Try It in the Model · 在模型裡試試
Then try it yourself: set A to 1 and B to 1. Which wirings turn the light on, and which one cannot even use B?
接著自己試:把 A 和 B 都設成 1。哪幾種接法燈會亮?哪一種根本用不到 B?
Watch all four rows of the table. In how many of them does the light turn on?
把真值表的四列都看一遍。有幾列燈會亮?
Now the current has two roads. Which is the only row that leaves the light off?
現在電有兩條路可以走。只有哪一列燈不亮?
Push the handle down and look at the other end of the seesaw. Why does the light go off?
把把手壓下去,看看蹺蹺板的另一頭。燈為什麼滅了?
Leave the switches alone and change only the wires, from AND to OR and back.
開關不動,只把線從 AND 改成 OR,再改回來。
Try It · 動手試試
Each puzzle is a rule from everyday life. Choose AND or OR, and decide whether to put a NOT in front of A or B. The table compares what the rule wants with what your circuit does. When all four rows match, the light turns on.
每一題都是生活裡的一條規則。選 AND 或 OR,再決定要不要在 A 或 B 的前面加一個 NOT。表格會把「規則要的」和「你接的電路做的」一列一列對照;四列都對了,燈就亮。
Solved · 已完成 0 / 6
Your circuit · 你接的電路
| A | B | Wanted要的 | Yours你接的 |
|---|
Game · 小遊戲
Eight questions. You are given A and B, and you answer 0 or 1. The first questions use one gate; the last three join two. The game counts how many you get right on the first try.
一共八題。題目給你 A 和 B,你回答 0 或 1。前面幾題只有一個閘,最後三題把兩個閘接在一起。遊戲會記下你第一次就答對幾題。
Right on the first try · 第一次就答對 0 / 0
Stories Behind the Gates · 邏輯閘的故事
Four short stories about where the logic in a computer came from.
電腦裡的邏輯從哪裡來的四個小故事。
1854 · George Boole
George Boole was born in Lincoln, England, in 1815. Apart from lessons from his father and a few years at local schools, he was self-taught in mathematics. He began teaching in village schools at 16 and opened his own school at 20. In 1849 he became professor of mathematics at Queen’s College in Cork, Ireland, even though he had no university degree. His 1854 book on the laws of thought was, in his own view, the mature statement of his ideas.
喬治・布爾 1815 年生於英格蘭的林肯。除了父親教他的和在當地學校讀的幾年,他的數學都是自學的。他 16 歲開始在鄉村學校教書,20 歲自己開了一所學校。1849 年,他成為愛爾蘭科克的皇后學院數學教授,雖然他沒有大學學位。1854 年那本談思維法則的書,是他自己認為最成熟的一次陳述。
MIT · Claude Shannon
For decades, Boole’s algebra was a subject for logicians. Claude Shannon, the same person who gave us the word “bit” in Lesson 1, changed that. His master’s thesis at MIT, A Symbolic Analysis of Relay and Switching Circuits, used Boolean algebra to work out circuits made of switches. Britannica says it established the theoretical underpinnings of digital circuits and has been called one of the most significant master’s theses of the 20th century.
有好幾十年,布爾的代數是邏輯學家在研究的東西。改變這件事的是克勞德・夏農,就是第一課裡讓「bit」這個詞傳開的那個人。他在麻省理工學院的碩士論文〈繼電器與開關電路的符號分析〉,用布林代數來推算開關接成的電路。大英百科說,這篇論文奠定了數位電路的理論基礎,被稱為二十世紀最重要的碩士論文之一。
true / false
Programmers call a value that can only be true or false a Boolean, after George Boole. Programming languages have the three gates built in. In JavaScript, the language of web pages, AND is written &&, OR is written ||, and NOT is written !. So true && false gives false, true || false gives true, and !true gives false. You can try all three in your browser in the second activity below.
寫程式的人把「只能是真或假」的值叫做 Boolean(布林值),就是用喬治・布爾的名字取的。程式語言裡本來就有這三種閘。在網頁用的 JavaScript 裡,AND 寫成 &&,OR 寫成 ||,NOT 寫成 !。所以 true && false 得到 false,true || false 得到 true,!true 得到 false。下面的第二個活動,就是在瀏覽器裡把這三個都試一遍。
OR · 或
“Soup or salad?” usually means choose one, not both. A logic OR is different: A OR B is 1 when A is 1, when B is 1, and also when both are 1. A truth table shows it plainly: “p or q” is false only when both are false. The choose-only-one kind has its own name, exclusive OR, or XOR. It is 1 when exactly one input is 1, and it will be useful in the next lesson.
「湯或沙拉?」通常是要你選一樣,不是兩樣都要。邏輯的 OR 不一樣:A 是 1、B 是 1,或者兩個都是 1 的時候,A OR B 都是 1。真值表寫得很清楚:「p 或 q」只有在兩個都是假的時候才是假。「只能選一個」的那種有自己的名字,叫做互斥或(XOR):恰好只有一個輸入是 1 的時候才是 1。下一課會用到它。
Myth vs. Fact · 常見迷思
✗ Myth · 迷思A computer thinks about a question the way a person does.電腦像人一樣思考問題。
✓ Fact · 事實A gate does not know what its inputs mean. It only follows its wiring: 1s and 0s in, a 1 or a 0 out. People decide what the inputs stand for and how the gates are joined.邏輯閘不知道它的輸入代表什麼。它只是照著接線走:進來 1 和 0,出去一個 1 或 0。輸入代表什麼、閘要怎麼接,是人決定的。
✗ Myth · 迷思1 AND 1 is 2.1 AND 1 等於 2。
✓ Fact · 事實AND is not addition. It asks a question: are both inputs 1? The answer is yes, which is written 1. A gate can never give out anything but 0 or 1.AND 不是加法。它在問一個問題:兩個輸入都是 1 嗎?答案是「是」,寫成 1。邏輯閘吐出來的永遠只有 0 或 1。
✗ Myth · 迷思OR means one or the other, but not both.OR 的意思是二選一,不能兩個都是。
✓ Fact · 事實In logic, A OR B is also 1 when both are 1. The one-but-not-both kind is a different gate called XOR.在邏輯裡,兩個都是 1 的時候 A OR B 也是 1。「只能一個、不能兩個」是另一種閘,叫做 XOR。
✗ Myth · 迷思A computer needs a different kind of part for every kind of decision.電腦每做一種決定,就需要一種不同的零件。
✓ Fact · 事實The same few kinds of gates are used over and over. What changes is how many there are and how they are wired together.用來用去就是那幾種閘。不一樣的是用了多少個、怎麼接在一起。
Remember It · 記憶口訣
In a row. 1 only when both are 1.
排成一排。兩個都是 1 才是 1。
Side by side. 0 only when both are 0.
一上一下。兩個都是 0 才是 0。
One in, the opposite out.
一個進去,相反的出來。
A truth table lists every possible input: 2 rows for one input, 4 for two, 8 for three.
真值表把每一種可能的輸入都列出來:一個輸入 2 列,兩個 4 列,三個 8 列。
Before You Start · 動手之前
Classroom Activity 1 · 課堂活動一
You need · 準備材料
Steps · 步驟
The gate students never need to know what A and B stand for. They only follow a card. That is exactly the point of the first myth above. In Taiwan’s junior high Information Technology curriculum, logic gates are not listed by name; this lesson supports the topic “System platforms” (資 S-IV-2, how system platforms are built and basically work).
當邏輯閘的同學完全不需要知道 A、B 代表什麼,只要照卡片做。這正是上面第一個迷思要說的事。十二年國教國中「資訊科技」的學習內容沒有直接列出邏輯閘;這一課可以用來支援「系統平台」主題(資 S-IV-2 系統平台之組成架構與基本運作原理)。
Classroom Activity 2 · 課堂活動二
You need · 準備材料
Steps · 步驟
The answers are false, true, false, false, and false. A spreadsheet has the same gates: in Google Sheets or Excel, type =AND(TRUE, FALSE), =OR(TRUE, FALSE), and =NOT(TRUE). The words are different, but the truth tables are the same ones Boole’s algebra describes.
答案依序是 false、true、false、false、false。試算表裡也有同樣的閘:在 Google 試算表或 Excel 輸入 =AND(TRUE, FALSE)、=OR(TRUE, FALSE)、=NOT(TRUE)。寫法不同,真值表卻是布林代數描述的同一張。
Go Further · 延伸閱讀
Sources · 資料出處
Names, dates, and facts on this page were checked against these sources (October 2026); the truth tables and puzzles are computed and tested · 本頁的人名、年代與事實依下列資料查證(2026 年 10 月);真值表與題目是自己算的,並有測試