{"base":{"id":"cs10-28","subject":"Computer systems","title":"Logic circuits and expressions","scene":"mix","steps":[{"use":"cs10t3","mode":"circuit","eyebrow":"Reading a circuit","title":"Left to right","body":"A logic circuit joins gates. Work out each gate's output in turn. Tap A, B and C and watch the row of the truth table light up.","actions":[{"id":"a","label":"Toggle A"},{"id":"b","label":"Toggle B"},{"id":"c","label":"Toggle C"}],"variant":0},{"use":"cs10t3","mode":"circuit","eyebrow":"NOT in a circuit","title":"Flip one input first","body":"Here C goes through a NOT gate before the AND. Try all eight combinations.","actions":[{"id":"a","label":"Toggle A"},{"id":"b","label":"Toggle B"},{"id":"c","label":"Toggle C"}],"variant":1},{"use":"cs10t3","mode":"circuit","eyebrow":"NAND in a circuit","title":"An inverted AND","body":"This circuit uses NAND. When is X = 1?","actions":[{"id":"a","label":"Toggle A"},{"id":"b","label":"Toggle B"},{"id":"c","label":"Toggle C"}],"variant":2},{"use":"code","mode":"combo","eyebrow":"From a problem to logic","title":"All conditions at once","body":"A real problem can be written as a logic expression. Answer the questions, then run it.","actions":[{"id":"ticket","label":"Has ticket"},{"id":"member","label":"Member"},{"id":"banned","label":"Banned"}]},{"use":"cs10t3","mode":"quiz","look":"circuit","eyebrow":"Check yourself","title":"Evaluate","body":"X = (A AND B) OR C. Inputs: A = 1, B = 0, C = 0.","question":"What is X?","options":["1","0","Cannot tell"],"answer":1,"right":"Correct. A AND B = 0, then 0 OR 0 = 0.","wrong":"Not quite. Work out the bracket first."}],"more":[{"type":"cards","id":"worked","eyebrow":"Worked examples","title":"Step by step","items":[{"tag":"Expression","title":"From words","body":"\"The alarm sounds if the door is open AND the system is armed,\nOR the panic button is pressed\"\nX = (D AND S) OR P","code":true},{"tag":"Table","title":"X = (A OR B) AND NOT C","body":"A B C | A OR B | NOT C | X\n0 0 0 |   0    |   1   | 0\n0 1 0 |   1    |   1   | 1\n1 1 1 |   1    |   0   | 0","code":true},{"tag":"Circuit","title":"Draw from expression","body":"X = NOT (A AND B) AND C\n1. A, B → NAND\n2. NAND output and C → AND → X","code":true},{"tag":"Check","title":"Working column","body":"add a column for every gate output;\nthe last column is X","code":true}]},{"type":"cards","id":"mistakes","eyebrow":"Common mistakes","title":"Watch out for these","items":[{"tag":"Mistake","title":"Ignoring brackets","body":"Evaluate brackets first, like in maths."},{"tag":"Mistake","title":"Missing intermediate columns","body":"Write each gate's output in its own column so you don't lose track."},{"tag":"Mistake","title":"Listing rows randomly","body":"Count in binary from 000 to 111."},{"tag":"Mistake","title":"Drawing NOT as a separate input","body":"NOT takes one input and sits on the wire."}]},{"type":"cards","id":"method","eyebrow":"Set out your answer","title":"Completing a truth table","items":[{"tag":"1","title":"Inputs","body":"Write all combinations from 000 to 111."},{"tag":"2","title":"Gate by gate","body":"Add a column for each gate, in order."},{"tag":"3","title":"Output","body":"The last gate gives X."},{"tag":"4","title":"Check","body":"Test one row by tracing the circuit."}]},{"type":"cards","id":"deeper","eyebrow":"Go deeper","title":"More than the lesson","items":[{"tag":"How it works","title":"Adders","body":"Chaining full adders, each made of XOR, AND and OR gates, lets a processor add 64-bit numbers in a single clock tick."},{"tag":"Real world","title":"Safety systems","body":"Industrial machines use logic so they only run when the guard is closed AND two hands are on the buttons. It keeps fingers away from blades."},{"tag":"Going further","title":"Simplifying","body":"Boolean algebra rules can simplify circuits so they need fewer gates, making chips cheaper and faster."}]},{"type":"cards","id":"challenge","eyebrow":"Challenge yourself","title":"Stretch your brain","intro":"Try each one on paper before opening the card.","items":[{"tag":"Challenge","title":"Write","body":"Write an expression: a greenhouse fan turns on if it is hot AND NOT raining, OR the manual switch is on.\n\nAnswer: X = (H AND NOT R) OR M."},{"tag":"Challenge","title":"Evaluate","body":"X = NOT (A OR B) AND C with A = 0, B = 0, C = 1.\n\nAnswer: A OR B = 0, NOT = 1, 1 AND 1 = 1."},{"tag":"Challenge","title":"Count","body":"How many rows would a truth table with 4 inputs have?\n\nAnswer: 2⁴ = 16."}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Try it yourself","items":[{"title":"Logic circuit on paper","time":"20 minutes","need":["Paper, ruler and pencil"],"steps":["Choose a rule for a game, e.g. \"you win if you have the key AND (the door code OR the password)\".","Write it as an expression.","Draw the circuit and complete the 8-row truth table."],"why":"You turned a real rule into a circuit and a truth table.","safety":"None."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Eight more questions","questions":[{"question":"In X = (A AND B) OR C, which is done first?","options":["B OR C","Either","A AND B"],"answer":2,"right":"Correct.","wrong":"Not quite."},{"question":"A = 1, B = 1, C = 0 for (A AND B) OR C gives…","options":["1","0","2"],"answer":0,"right":"Correct.","wrong":"Not quite."},{"question":"NOT C with C = 1 gives…","options":["1","0","C"],"answer":1,"right":"Correct.","wrong":"Not quite."},{"question":"Three inputs give how many combinations?","options":["3","9","8"],"answer":2,"right":"Correct.","wrong":"Not quite."},{"question":"(A OR B) AND NOT C with A=0, B=1, C=0 gives…","options":["1","0","undefined"],"answer":0,"right":"Correct.","wrong":"Not quite."},{"question":"An intermediate column shows…","options":["the final answer only","the output of one gate","the inputs"],"answer":1,"right":"Correct.","wrong":"Not quite."},{"question":"\"Door open AND alarm armed\" uses which gate?","options":["OR","NOT","AND"],"answer":2,"right":"Correct.","wrong":"Not quite."},{"question":"NOT (A AND B) is the same as…","options":["A NAND B","A NOR B","A XOR B"],"answer":0,"right":"Correct.","wrong":"Not quite."}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can…","items":["trace a logic circuit with up to three inputs","complete truth tables with intermediate columns","write a logic expression from a circuit","draw a circuit from an expression","turn a written problem into a logic expression"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"Logic circuit","meaning":"Gates connected together."},{"word":"Logic expression","meaning":"A formula like X = (A AND B) OR C."},{"word":"Intermediate output","meaning":"The output of a gate inside a circuit."},{"word":"Input combination","meaning":"One set of input values, like 101."}]},{"type":"sources","id":"sources","title":"Sources","items":["Raspberry Pi Foundation, Isaac Computer Science: Boolean logic","Nand2Tetris: The Elements of Computing Systems, chapter 1","BBC Bitesize, GCSE Computer Science: logic circuits","Khan Academy: logic gates"]}]},"overlay":null}