[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-17 17:37:13
Message-ID: E1diOjJ-0002t6-15 () code ! kde ! org
[Download RAW message or body]
Git commit 7732c8ed7d44cc03cb284b1612a92fccce46ce7c by Rudra Nil Basu.
Committed on 17/08/2017 at 17:33.
Pushed by rudranilbasu into branch 'gsoc_pulkit_digital_electricity'.
digital_electricity: bcd counter tutorial
Added level 22 (final level, as of now) aims at giving a basic idea of
how the bcd counter works.
The checking procedure is a bit different from others, which is done by:
check if all the terminals for the bcd counter is connected
if false, return wrong answer
if true and digital(valueOf(bcdCounter)) ==
digital(valueOf(digitalLights)) then correct, else wrong
Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
M +29 -1 src/activities/digital_electricity/Dataset.qml
M +28 -0 src/activities/digital_electricity/digital_electricity.js
https://commits.kde.org/gcompris/7732c8ed7d44cc03cb284b1612a92fccce46ce7c
diff --git a/src/activities/digital_electricity/Dataset.qml \
b/src/activities/digital_electricity/Dataset.qml index b4748862..821daeb4 100644
--- a/src/activities/digital_electricity/Dataset.qml
+++ b/src/activities/digital_electricity/Dataset.qml
@@ -113,6 +113,20 @@ QtObject {
'height': 0.4,
'toolTipText': qsTr("7 Segment Display")
}
+ property var signalGenerator: {
+ 'imageName': 'signalGenerator.svg',
+ 'componentSource': 'SignalGenerator.qml',
+ 'width': 0.25,
+ 'height': 0.18,
+ 'toolTipText': qsTr("Signal Generator")
+ }
+ property var bcdCounter: {
+ 'imageName': 'bcdCounter.svg',
+ 'componentSource': 'BcdCounter.qml',
+ 'width': 0.3,
+ 'height': 0.4,
+ 'toolTipText': qsTr("BCD Counter")
+ }
// tutorial levels
property var tutorialLevels: [
// level 1
@@ -380,7 +394,21 @@ QtObject {
qsTr("The component in the middle is the BCD to seven segment \
converter."),
qsTr("It takes 4 bits as input represented in the binary coded \
decimal (BCD) format and converts the BCD number into a seven segment \
code."),
qsTr("The output of the converter is connected to the seven segment \
display, to view the value of the input provided."),
- qsTr("Display the number \"6\" in the seve segment display."),
+ qsTr("Display the number \"6\" in the seven segment display.")
+ ]
+ },
+ // level 22
+ {
+ inputComponentList: [one, switchKey, nandGate, norGate, andGate, orGate, \
notGate], + playAreaComponentList: [signalGenerator, bcdCounter, \
digitalLight, digitalLight, digitalLight, digitalLight], + \
determiningComponentsIndex: [1, 2, 3, 4, 5], + wires: [ ],
+ playAreaComponentPositionX: [0.1, 0.3, 0.7, 0.7, 0.7, 0.7],
+ playAreaComponentPositionY: [0.2, 0.5, 0.2, 0.4, 0.6, 0.8],
+ introMessage: [
+ qsTr("The signal generator on the left is used to generate \
alternating signals between 0 and 1 in a given time period take as input. The time \
period by default is 1 second, but it can be changed between 0.25 and 2s"), + \
qsTr("The BCD counter placed next to it is a special type of counter which can count \
to ten on application of a clock signal."), + qsTr("Connect the \
components to make sure that the count of 0 to 10 is visible in the digital lights \
provided.") ]
}
]
diff --git a/src/activities/digital_electricity/digital_electricity.js \
b/src/activities/digital_electricity/digital_electricity.js index c4f7be81..f882b77d \
100644
--- a/src/activities/digital_electricity/digital_electricity.js
+++ b/src/activities/digital_electricity/digital_electricity.js
@@ -540,6 +540,34 @@ function checkAnswer() {
return
}
items.bonus.bad('tux')
+ } else if (currentLevel == 22) {
+ var bcdCounter = determiningComponents[0]
+
+ var bcdOutput =
+ bcdCounter.outputTerminals.itemAt(3).value +
+ bcdCounter.outputTerminals.itemAt(2).value * 2 +
+ bcdCounter.outputTerminals.itemAt(1).value * 4 +
+ bcdCounter.outputTerminals.itemAt(0).value * 8
+
+ var digitalLightOutput =
+ determiningComponents[4].inputTerminals.itemAt(0).value +
+ determiningComponents[3].inputTerminals.itemAt(0).value * 2 +
+ determiningComponents[2].inputTerminals.itemAt(0).value * 4 +
+ determiningComponents[1].inputTerminals.itemAt(0).value * 8
+
+ if (bcdCounter.inputTerminals.itemAt(0).wires.length == 0 ||
+ bcdCounter.outputTerminals.itemAt(0).wires.length == 0 ||
+ bcdCounter.outputTerminals.itemAt(1).wires.length == 0 ||
+ bcdCounter.outputTerminals.itemAt(2).wires.length == 0 ||
+ bcdCounter.outputTerminals.itemAt(3).wires.length == 0) {
+ items.bonus.bad('tux')
+ return
+ }
+ if ((bcdOutput == digitalLightOutput) && \
(bcdCounter.inputTerminals.itemAt(0).wires.length != 0) ) { + \
items.bonus.good('tux') + return
+ }
+ items.bonus.bad('tux')
}
else {
if (determiningComponents[0].inputTerminals.itemAt(0).value == 1)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic