你有沒有看過爸爸開車時,在小巷子裡跟別人的車子「大眼瞪小眼」,誰也不肯退、誰也過不去?這在電腦科學裡叫做「死結 (Deadlock)」。(有些遊戲畫面卡住不動,偶爾也是類似的原因。)
The internet is like a road, and data (packets) are like cars. If there are no good traffic rules, or if everyone is too selfish (only taking, never giving), the network will crash.
Today, we are going to turn your house into a mini-network. Using a few "oranges (or balls)," we will play a puzzle game that tests the family's chemistry!
In computer networks, if every program looks out only for itself (Greedy), the whole system becomes paralyzed. Through this "Fruit Passing Game," we will let children personally experience what a "Mega Traffic Jam (Deadlock)" feels like, and how to make the network flow again through cooperation.
Phase 1: The Cost of Selfishness
First, we need to manufacture a "stuck" situation so the child understands why computers crash.
- The Mission Setup:
- Find 5 people (or use stuffed animals to save spots) and sit in a circle.
- Stick a label on everyone (A, B, C, D, E).
- 道具分配: 每個字母準備兩顆水果(兩顆貼 A、兩顆貼 B…),但其中一個字母只準備一顆(共 9 顆,才留得出一隻「空手」)。把這些水果打亂分給大家(注意:不要讓任何人一開始就拿到自己字母的水果)。
- Everyone should hold two fruits, but ensure one person only holds one, leaving them with one "Empty Hand."
- Rules Explanation:
- Goal: Your label is A. By the end, you must be holding two "A" fruits.
- Movement Rule: You can only pass fruit to your left or right neighbor. Crucially, you can only pass to them if they have an Empty Hand (because one hand can only hold one fruit).
- Manufacturing Deadlock:
- Tell the child: "Okay, as soon as you get the fruit that matches your label (e.g., A gets an A), hold onto it tight and do not pass it to anyone else!"
- 結果: 遊戲開始沒多久,多半就會卡住。因為每個人都抓著自己的水果不放,沒人願意騰出手來幫忙傳遞別人的水果。那隻「空手」還在,但它旁邊的人都抓著自己的水果不肯傳,空位動不了,整個圈子就卡死了。
- "This is a 'Deadlock.' It's like four cars at a 4-way stop, and everyone wants to go first. The result? No one goes anywhere."

Phase 2: System Reboot—Let the Empty Space Flow
We need to break the stalemate and introduce the concept of "Routing."
- Guiding Reflection:
- 「剛剛我們失敗了,因為大家都太『自私』(也就是拿到自己該拿的水果之後就不再傳了)。為了讓A水果穿過中間、傳回 A 的手上,B和C就算拿到了自己的水果,是不是也得暫時幫忙傳遞一下?」
- The New Strategy:
- We are no longer looking out only for ourselves. Our goal is to make that one "Empty Hand" run around the circle.
- The Mantra: 「"If you see a gap, fill it! If you have a ball, pass it!"」
Phase 3: The Algorithm of Cooperation
- Executing the Mission:
- Start over. This time, the children must observe: Where is the empty slot (Empty Hand)?
- Scenario: If I am B, and I am holding C's orange, and my neighbor C happens to have an empty hand, I must quickly pass the orange to them.
- Scenario: If I am D, and I have my own D orange, but A's orange is stuck behind me, I must be willing to pass my D orange to a neighbor temporarily to free up space for A to pass through.
- Dynamic Observation:
- You will see the oranges flowing rapidly around the circle, just like traffic moving on a highway.
- Eventually, everyone will hold the oranges that match their labels!
- The Cheer : "We unlocked the Deadlock! The network is flowing!"
Phase 4: Concept Connection
Why Did Everyone Get Stuck?
We just saw that if everyone grabs an orange and refuses to let go, the game ends. In the real world, this "refusal to yield" happens everywhere:
- 1. Traffic Gridlock
- Scenario: Imagine an intersection where cars enter from all four directions at once. Everyone tries to move forward, and they all get stuck in the middle.
- Connection: This is exactly like our game: Car A blocks Car B, B blocks C, and C blocks A. This is a classic Deadlock.
- Solution: Someone must back up (Release Resource) or follow traffic lights (Communication Protocol).
- 2. New Year's Eve Subway Crowds
- Scenario: Thousands of people trying to enter the subway station at once after the fireworks.
- Connection: When too many people compete for the same resource (the train door), pushing happens, and actually, fewer people get in. Speed drops to zero.
- The Concept of Routing: Station staff use megaphones to say, "To Taipei Main Station, go left; to Tamsui, go right." This is "Routing"—planning a path for the massive crowd (Data Packets) so they don't get tied in knots.
- 3. The Banking Deadlock
- Scenario: This is a computer's worst nightmare. Suppose Mike wants to wire money to Sarah, and Sarah wants to wire money to Mike at the exact same time.
- Connection: For safety, the computer "Locks" the accounts during a transfer.
- 如果程式寫得不好:處理「小明轉給小華」的程式先鎖住小明的帳戶,接著要去鎖小華的帳戶;同一時間,處理「小華轉給小明」的程式已經先鎖住小華的帳戶,也要來鎖小明的帳戶。兩邊各握著一個鎖、等對方先放手。
- 兩邊都在「等對方先動作」,結果這兩筆匯款就永遠卡住,處理不完。(實際的銀行系統會偵測到死結,強制取消其中一筆重來。)
Phase 5: Debug & Challenge
Changing the Topology
Networks aren't always circles. We can change the shape (Topology) to increase difficulty.
- Challenge 1: The Long Snake (Line Topology)
- Line everyone up in a straight row. The person on the far left must send a fruit to the person on the far right. The people in the middle will be extremely busy.
- Observation: If the people in the middle don't help, the ends can never exchange fruits. This demonstrates the critical job of a "Router."
- Challenge 2: Silent Mode
- Rule: No talking allowed! You can only use eye contact to signal your neighbor to extend their hand.
- 發現: 這是模擬真實的電腦網路,電腦之間沒辦法臨時討論,只能照事先講好的規則——「通訊協定 (Protocol)」——來傳遞資料。
Teaching Observation Checklist
This chart helps you guide the child to understand the conflict between "Local Greed" and "Global Cooperation."
| Observation Point | ❌ Less Effective Response (Preaching) | ✅ More Effective Scaffolding (Inspiring Thought) |
| When the child gets their ball and refuses to pass | "Don't be so selfish. Pass it on." | "Look, your hands are full. Your neighbor wants to give you a ball you need, but they can't. If you don't pass this one out to make space, will that other ball you want ever reach you?" |
| When the game gets stuck | "You guys are playing it wrong. Start over." | "What is happening right now? Does this look like a traffic jam? Is anyone willing to be the car that 'reverses' to make space so traffic can flow again?" |
| Explaining the need for an Empty Hand | "It's just the game rule." | "This empty hand is like the 'Safety Distance' between cars on the highway. If cars are bumper-to-bumper with zero gap, can anyone change lanes?" |
💡 Suggestions for Parents
這個活動至少需要 5 個人 才好玩(如果人夠多,可以把圈子圍大一點、或改排成一直線,難度都會不一樣)。如果人數不足,可以用玩偶代替其中幾個位置,由家長或孩子幫忙操作玩偶的手。最重要的是要讓孩子體驗到「我必須先把手上的東西給出去,最終我才能拿到我要的東西」這種合作邏輯,這正是網際網路能運作到今天的核心精神!
ORANGE_GAME // AUTO_DEMO
參考來源:CS Unplugged「The Orange Game—Routing and Deadlock in Networks」
延伸閱讀
- Unlocking the "Budget-Saving Paving Magic" through Muddy City: The Minimum Spanning Tree (MST)
- Faster than Lightning! Racing on Sorting Networks to Instantly Understand Supercomputer Parallel Computing
- The Pirate Captain's Treasure Map: Mastering Finite State Automata (FSA) with the "Island Hopping" Game
