{"id":6165,"date":"2023-01-01T23:49:04","date_gmt":"2023-01-01T23:49:04","guid":{"rendered":"https:\/\/computerscienced.co.uk\/site\/?page_id=6165"},"modified":"2023-01-01T23:49:04","modified_gmt":"2023-01-01T23:49:04","slug":"logic-gate-puzzle-1-ks3-and-ks4","status":"publish","type":"page","link":"https:\/\/computerscienced.co.uk\/site\/logic-gate-puzzles\/logic-gate-puzzle-1-ks3-and-ks4\/","title":{"rendered":"Logic Gate Puzzle 1 KS3 and KS4"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Logic circuit aim<\/h2>\n\n\n\n<link rel=\"stylesheet\" href=\"https:\/\/www.computerscienced.co.uk\/lechef\/build\/lechef.css\">\n<style> \/* editor styles *\/\n* {\n  box-sizing: border-box;\n}\n.circuit-exercise-container {\n  height: 300px;\n  width: 100%;\n  border: 1px solid #000;\n  padding: 0;\n  background-color: transparent;\n}\nbutton, [class=\"submit\"]{\nbackground-color: #4CAF50;\n}\nbutton, [class=\"addand\"]{\nbackground-color: #666666;\n}\n.lechef-close{\nbackground-color: #ff0000;\n}\n.circuit-exercise-container > svg {\n  z-index: 0;\n}\n\n  \/** styling the exercise feedback *\/\n\n  .circuit-feedback {\n    background-color: white;\n    z-index: 300;\n    position: absolute;\n    left: 0;\n    top: 0;\n    right: 0;\n    bottom: 0;\n  }\n  .circuit-feedback * {\n    z-index: 300;\n    cursor: auto !important;\n  }\n  .circuit-feedback .circuit {\n    position: relative;\n  }\ntable, th{\ntext-align:center;\n}\n #myDIVhelp {\n  width: 100%;\n  padding: 5px 0;\n  text-align: left;\n  background-color: #0073aa;\n  color: white;\n  margin-top: 5px;\ndisplay: none;\n} \n<\/style>\n<div id=\"explanation\" class=\"explanation\"><\/div>\n<button onclick=\"help()\">Help<\/button>\n<button onclick=\"location.reload();\">Click to try again<\/button>\n<div id=\"myDIVhelp\" onclick=\"help()\">\n<h2>Help<\/h2>\n<p>In this puzzle you must draw out the correct logic circuit by adding the correct gates into the diagram and connecting the inputs, outputs and gates together using wires.<\/p> \n<p>Click on the correct logic gate button at the top of the screen to add it to the diagram.<\/p>  \n<p>To join the inputs to the gate click and drag on the small circles until the line connects to another small circle on the gate or output as appropriate.<\/p>\n<p>You can tell when the line has connected correctly as the line will change from a red colour to a blue colour.<\/p>\n<p>If you make a mistake simply double click on the gate or wire to remove it.<\/p>\n<p>Once you have everything in place and connected together click on the &#8220;Check&#8221; button to check your answer.<\/p>\n<\/div>\n<div id=\"design-example-feedback\" class=\"circuit-exercise-container\">\n<\/div>\n<div class=\"party\" id=\"party\"><\/div>\n<script src=\"https:\/\/www.computerscienced.co.uk\/lechef\/libs\/jquery-2.1.1.min.js\"><\/script>\n<script src=\"https:\/\/www.computerscienced.co.uk\/lechef\/libs\/jquery-ui-1.11.min.js\"><\/script>\n<script src=\"https:\/\/www.computerscienced.co.uk\/lechef\/libs\/jquery.ui.touch-punch.min.js\"><\/script>\n<script src=\"https:\/\/www.computerscienced.co.uk\/lechef\/libs\/snap.svg.js\"><\/script>\n<script src=\"https:\/\/www.computerscienced.co.uk\/lechef\/lechef.js\"><\/script>\n<script>\n\nfunction help() {\nvar z = document.getElementById(\"myDIVhelp\");\n  if (z.style.display === \"block\") {\n    z.style.display = \"none\";\n  } else {\n    z.style.display = \"block\";\n  }\n}\n\/\/OR Gate\nvar div = document.getElementById('explanation');\ndiv.innerHTML += '<p>Construct a circuit using AND, OR, and NOT components that has the following truth-table.<\/p><table><thead><tr><th>Input X<\/th><th>Input Y<\/th><th>Output G<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>0<\/td><td>1<\/td><\/tr><tr><td>0<\/td><td>1<\/td><td>1<\/td><\/tr><tr><td>1<\/td><td>1<\/td><td>1<\/td><\/tr><tr><td>0<\/td><td>0<\/td><td>0<\/td><\/tr><\/tbody><\/table>';\n  var exer = new CircuitExercise({element: $(\".circuit-exercise-container\"), input: [\"x\", \"y\"], output: \"g\",\n    grading: [{input: {x: true, y: false}, output: true},\n      {input: {x: false, y: true}, output: true},\n      {input: {x: true, y: true}, output: true},\n      {input: {x: false, y: false}, output: false}], components: [\"and\", \"not\", \"or\"],\n      addSubmit: true});\n<\/script>\n\n\n\n<p>This code is based on lechef &#8211; Logic Circuit Exercise Framework by Ville Karanvirta available at&nbsp;<a href=\"https:\/\/vkaravir.github.io\/lechef\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/vkaravir.github.io\/lechef\/<\/a>&nbsp;and distributed under an MIT license<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Logic circuit aim Help Click to try again Help In this puzzle you must draw out the correct logic circuit&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2594,"parent":2044,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"disable_featured_image":true,"footnotes":""},"class_list":["post-6165","page","type-page","status-publish","has-post-thumbnail","hentry"],"blog_post_layout_featured_media_urls":{"thumbnail":["https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2021\/09\/undraw_circuit_board_4c4d.svg",150,150,true],"full":["https:\/\/computerscienced.co.uk\/site\/wp-content\/uploads\/2021\/09\/undraw_circuit_board_4c4d.svg",888,476,false]},"categories_names":null,"comments_number":"0","_links":{"self":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/comments?post=6165"}],"version-history":[{"count":2,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6165\/revisions"}],"predecessor-version":[{"id":6167,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/6165\/revisions\/6167"}],"up":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/pages\/2044"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/media\/2594"}],"wp:attachment":[{"href":"https:\/\/computerscienced.co.uk\/site\/wp-json\/wp\/v2\/media?parent=6165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}