[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 15:46:29
Message-ID: E1diN09-0006lQ-Cq () code ! kde ! org
[Download RAW message or body]
Git commit f59f40ff995a326fd3ed57a4becc3299d0427508 by Rudra Nil Basu.
Committed on 17/08/2017 at 15:43.
Pushed by rudranilbasu into branch 'gsoc_pulkit_digital_electricity'.
digital_electricity: bcd -> seven segment
Level 21 introduces conversion of BCD to seven segment display, using
the BCD To 7 Segment component and the seven segment display components.
This level is fairly in the easy category, which comprises of teaching
the basics of two components which are fairly new.
Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
M +29 -0 src/activities/digital_electricity/Dataset.qml
M +14 -0 src/activities/digital_electricity/digital_electricity.js
https://commits.kde.org/gcompris/f59f40ff995a326fd3ed57a4becc3299d0427508
diff --git a/src/activities/digital_electricity/Dataset.qml \
b/src/activities/digital_electricity/Dataset.qml index 2e3d3f8a..b4748862 100644
--- a/src/activities/digital_electricity/Dataset.qml
+++ b/src/activities/digital_electricity/Dataset.qml
@@ -99,6 +99,20 @@ QtObject {
'height': 0.25,
'toolTipText': qsTr("Comparator")
}
+ property var bcdToSevenSegment: {
+ 'imageName': 'BCDTo7Segment.svg',
+ 'componentSource': 'BCDToSevenSegment.qml',
+ 'width': 0.3,
+ 'height': 0.4,
+ 'toolTipText': qsTr("BCD To 7 Segment")
+ }
+ property var sevenSegmentDisplay: {
+ 'imageName': 'sevenSegmentDisplay.svgz',
+ 'componentSource': 'SevenSegment.qml',
+ 'width': 0.18,
+ 'height': 0.4,
+ 'toolTipText': qsTr("7 Segment Display")
+ }
// tutorial levels
property var tutorialLevels: [
// level 1
@@ -353,6 +367,21 @@ QtObject {
qsTr("A comparator takes two numbers (A and B) as input and produces \
3 values as output. First value is 1 if A < B, second value is 1 for A = B and third \
value is 1 for A > B."), qsTr("Create a circuit using the components provided such \
that the bulb will glow when the value of the current flowing through the first \
switch is less than or equal to that of the second switch.") ]
+ },
+ // level 21
+ {
+ inputComponentList: [one, switchKey, nandGate, norGate, andGate, orGate, \
notGate], + playAreaComponentList: [bcdToSevenSegment, \
sevenSegmentDisplay], + determiningComponentsIndex: [0, 1],
+ wires: [ [0, 0, 1, 0], [0, 1, 1, 1], [0, 2, 1, 2], [0, 3, 1, 3], [0, 4, \
1, 4], [0, 5, 1, 5], [0, 6, 1, 6] ], + playAreaComponentPositionX: [0.4, \
0.8], + playAreaComponentPositionY: [0.3, 0.3],
+ introMessage: [
+ 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."), + ]
}
]
}
diff --git a/src/activities/digital_electricity/digital_electricity.js \
b/src/activities/digital_electricity/digital_electricity.js index a1e41066..c4f7be81 \
100644
--- a/src/activities/digital_electricity/digital_electricity.js
+++ b/src/activities/digital_electricity/digital_electricity.js
@@ -526,6 +526,20 @@ function checkAnswer() {
}
}
items.bonus.good('tux')
+ } else if (currentLevel == 21) {
+ var bcdToSevenSegment = determiningComponents[0]
+
+ var decimalValue =
+ bcdToSevenSegment.inputTerminals.itemAt(3).value +
+ (bcdToSevenSegment.inputTerminals.itemAt(2).value * 2) +
+ (bcdToSevenSegment.inputTerminals.itemAt(1).value * 4) +
+ (bcdToSevenSegment.inputTerminals.itemAt(0).value * 8)
+
+ if (decimalValue == 6) {
+ 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