[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gcompris/gsoc_pulkit_digital_electricity] src/activities/digital_electricity: digital_electricity: 
From:       Rudra Nil Basu <null () kde ! org>
Date:       2017-08-13 15:22:30
Message-ID: E1dguik-0002i1-6G () code ! kde ! org
[Download RAW message or body]

Git commit e286b1ce3642473c6384c1e1428ecff95265d416 by Rudra Nil Basu.
Committed on 13/08/2017 at 15:20.
Pushed by rudranilbasu into branch 'gsoc_pulkit_digital_electricity'.

digital_electricity: Add universal and XOR gates

Added XOR gates and the two universal gates, namely NOR and NAND gates.
Also, added two basic levels (7 and 8) and to demonstrate the uses of
the XOR and NAND gates along with level 9 to demonstrate the use of
XOR gates using 3 inputs

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>

M  +62   -0    src/activities/digital_electricity/Dataset.qml

https://commits.kde.org/gcompris/e286b1ce3642473c6384c1e1428ecff95265d416

diff --git a/src/activities/digital_electricity/Dataset.qml b/src/activitie=
s/digital_electricity/Dataset.qml
index 48e422e6..24598d82 100644
--- a/src/activities/digital_electricity/Dataset.qml
+++ b/src/activities/digital_electricity/Dataset.qml
@@ -64,6 +64,27 @@ QtObject {
         'height': 0.12,
         'toolTipText': qsTr("NOT gate")
     }
+    property var xorGate: {
+        'imageName': 'gateXor.svg',
+        'componentSource': 'XorGate.qml',
+        'width': 0.15,
+        'height': 0.12,
+        'toolTipText': qsTr("XOR gate")
+    }
+    property var nandGate: {
+        'imageName': 'gateNand.svg',
+        'componentSource': 'NandGate.qml',
+        'width': 0.15,
+        'height': 0.12,
+        'toolTipText': qsTr("NAND gate")
+    }
+    property var norGate: {
+        'imageName': 'gateNor.svg',
+        'componentSource': 'NorGate.qml',
+        'width': 0.15,
+        'height': 0.12,
+        'toolTipText': qsTr("NOR gate")
+    }
     property var switchKey: {
         'imageName': 'switchOff.svg',
         'componentSource': 'Switch.qml',
@@ -145,6 +166,47 @@ QtObject {
             introMessage: [
                 qsTr("Light the bulb using both the switches such that the=
 bulb will glow when only one of the switches are turned on")
             ]
+        },
+        // level 7
+        {
+            inputComponentList: [zero, one],
+            playAreaComponentList: [nandGate, digitalLight],
+            determiningComponentsIndex: [1],
+            wires: [ [0, 0, 1, 0] ],
+            playAreaComponentPositionX: [0.4, 0.8],
+            playAreaComponentPositionY: [0.4, 0.4],
+            introMessage: [
+                qsTr("The NAND Gate takes two binary inputs and produces o=
ne binary output"),
+                qsTr("The output of the NAND gate will be zero if the both=
 the inputs are \"0\". Else, the output will be one."),
+                qsTr("For a more detailed description about the gate, sele=
ct it and click on the info button."),
+                qsTr("Light the bulb using the NAND gate provided.")
+            ]
+        },
+        // level 8
+        {
+            inputComponentList: [zero, one],
+            playAreaComponentList: [xorGate, digitalLight],
+            determiningComponentsIndex: [1],
+            wires: [ [0, 0, 1, 0] ],
+            playAreaComponentPositionX: [0.4, 0.8],
+            playAreaComponentPositionY: [0.4, 0.4],
+            introMessage: [
+                qsTr("The XOR Gate takes two binary inputs and produces on=
e binary output"),
+                qsTr("The output of the XOR gate will be one if the number=
 of \"1\" in the input is odd. Else, the output will be zero."),
+                qsTr("Light the bulb using the XOR gate provided.")
+            ]
+        },
+        // level 9
+        {
+            inputComponentList: [zero, one, xorGate],
+            playAreaComponentList: [switchKey, switchKey, switchKey, digit=
alLight],
+            determiningComponentsIndex: [0, 1, 2, 3],
+            wires: [  ],
+            playAreaComponentPositionX: [0.2, 0.2, 0.2, 0.8],
+            playAreaComponentPositionY: [0.2, 0.4, 0.6, 0.4],
+            introMessage: [
+                qsTr("Light the bulb using the three switches such that th=
e bulb glows when odd number of the switches are turned on")
+            ]
         }
     ]
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic