{"base":{"id":"cs8-09","subject":"Algorithms","title":"AND, OR and NOT","scene":"code","steps":[{"mode":"and","eyebrow":"AND","title":"Both must be TRUE","body":"Some decisions need two conditions at once. With AND, the result is TRUE only when both conditions are TRUE. To go on this ride you must be tall enough and old enough.","controls":[{"id":"height","label":"Height","min":100,"max":160,"step":5,"value":130,"unit":"cm"},{"id":"age","label":"Age","min":5,"max":14,"step":1,"value":10}]},{"mode":"or","eyebrow":"OR","title":"At least one TRUE","body":"With OR, the result is TRUE when at least one condition is TRUE. Children under 5 and people aged 65 or over get a free ticket. Move the age slider.","controls":[{"id":"age","label":"Age","min":0,"max":90,"step":1,"value":30}]},{"mode":"not","eyebrow":"NOT","title":"Flip the condition","body":"NOT turns TRUE into FALSE and FALSE into TRUE. This program only says “Play outside” when it is not raining. Make it rain and watch NOT flip.","actions":[{"id":"rain","label":"Make it rain"}]},{"mode":"combo","eyebrow":"Combining","title":"Brackets first","body":"Conditions can be combined. A person may enter if they have a ticket or are a member, and are not banned. Switch each one on and off and work it out from the inside.","actions":[{"id":"ticket","label":"Has a ticket"},{"id":"member","label":"Is a member"},{"id":"banned","label":"Is banned"}]},{"mode":"quiz","eyebrow":"Check yourself","title":"Free entry?","body":"A museum gives free entry to students OR people under 12. Sam is 15 and a student.","question":"Does Sam get free entry?","options":["No, Sam isn't under 12","Only if both are TRUE","Yes, one condition is TRUE"],"answer":2,"right":"Correct. OR needs only one TRUE condition. Being a student is enough.","wrong":"Not quite. How many conditions must be TRUE for OR?","look":"or"}],"more":[{"type":"cards","id":"ideas","eyebrow":"Popular idea vs science","title":"Common mix-ups","items":[{"tag":"Popular idea","title":"\"OR means one or the other, but not both.\"","body":"In computing, OR is also TRUE when both conditions are TRUE."},{"tag":"Popular idea","title":"\"AND is easier to satisfy than OR.\"","body":"AND is harder: both parts must be TRUE. OR needs only one."},{"tag":"Popular idea","title":"\"NOT changes the question.\"","body":"NOT keeps the same condition and simply flips its TRUE/FALSE result."}]},{"type":"cards","id":"tables","eyebrow":"Truth tables","title":"All the answers","items":[{"tag":"AND","title":"TRUE only if both are TRUE","body":"A      B      A AND B\nFALSE  FALSE  FALSE\nFALSE  TRUE   FALSE\nTRUE   FALSE  FALSE\nTRUE   TRUE   TRUE","code":true},{"tag":"OR","title":"TRUE if at least one is TRUE","body":"A      B      A OR B\nFALSE  FALSE  FALSE\nFALSE  TRUE   TRUE\nTRUE   FALSE  TRUE\nTRUE   TRUE   TRUE","code":true},{"tag":"NOT","title":"Flips the value","body":"A      NOT A\nFALSE  TRUE\nTRUE   FALSE","code":true}]},{"type":"cards","id":"history","eyebrow":"Did you know?","title":"George Boole","items":[{"tag":"1854","title":"The logic of TRUE and FALSE","body":"The English mathematician George Boole wrote about logic using only two values. About 80 years later, engineers used his ideas to design computer circuits. TRUE/FALSE values are called Boolean in his honour."}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Rule maker","items":[{"title":"Club rules","time":"15 minutes","need":["Paper and a pen","Family members or friends"],"steps":["Invent a rule for a pretend club using AND, OR or NOT, e.g. 'age >= 10 AND likes football'.","Write each person's details and work out TRUE or FALSE for each part.","Combine the parts to decide who may join.","Change AND to OR. Who joins now?"],"why":"Changing one Boolean operator can change many results. Truth tables help you check every case.","safety":"No safety risks."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Six more questions","questions":[{"question":"A AND B is TRUE when…","options":["both A and B are TRUE","either is TRUE","both are FALSE"],"answer":0,"right":"Correct. AND needs both.","wrong":"Not quite. Look at the AND truth table."},{"question":"A OR B is FALSE when…","options":["A is TRUE","both are FALSE","both are TRUE"],"answer":1,"right":"Correct. OR is only FALSE if nothing is TRUE.","wrong":"Not quite. When can OR fail?"},{"question":"NOT FALSE is…","options":["FALSE","Neither","TRUE"],"answer":2,"right":"Correct. NOT flips the value.","wrong":"Not quite. NOT turns it into the opposite."},{"question":"height >= 120 AND age >= 8. Height 125, age 7. Result?","options":["FALSE","TRUE","It depends"],"answer":0,"right":"Correct. age >= 8 is FALSE, so AND is FALSE.","wrong":"Not quite. Check each part separately."},{"question":"Which rule lets in people who are EITHER teachers OR parents?","options":["teacher OR parent","teacher AND parent","NOT teacher"],"answer":0,"right":"Correct. OR needs just one to be TRUE.","wrong":"Not quite. Only one needs to be true."},{"question":"(ticket OR member) AND NOT banned: ticket TRUE, member FALSE, banned TRUE. Result?","options":["TRUE","FALSE","Both"],"answer":1,"right":"Correct. NOT banned is FALSE, so the AND is FALSE.","wrong":"Not quite. Work out NOT banned first."}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can explain…","items":["what a Boolean value is","when AND, OR and NOT give TRUE","how to read a truth table","how to work out a combined condition from the inside out","which inputs to test so every row is checked"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"Boolean","meaning":"A value that is either TRUE or FALSE."},{"word":"AND","meaning":"TRUE only when both conditions are TRUE."},{"word":"OR","meaning":"TRUE when at least one condition is TRUE."},{"word":"NOT","meaning":"Flips TRUE to FALSE and FALSE to TRUE."},{"word":"truth table","meaning":"A table listing every input combination and its result."}]},{"type":"sources","id":"sources","title":"Sources","items":["BBC Bitesize KS3 Computing: Boolean logic","G. Boole, An Investigation of the Laws of Thought (1854)"]}]},"overlay":null}