Commit fd90c5aa authored by Shubham Mishra's avatar Shubham Mishra

share, updated datasets

parent 1a660622
......@@ -28,15 +28,11 @@ var currentLevel = 0
var numberLevelsWords = 2
var currentSubLevel = 0;
var numberOfLevel
var words3Letters = []
var words4Letters = []
var words5Letters = []
var items
var url = "qrc:/gcompris/src/activities/crane/resource/"
var allNames = ["bulb.svg","letter-a.svg","letter-b.svg",
"rectangle1.svg","rectangle2.svg","square1.svg",
"square2.svg","triangle1.svg","triangle2.svg",
"tux.svg","water_drop1.svg","water_drop2.svg",
"water_spot1.svg","water_spot2.svg"]
var currentLocale
var names = []
var names2 = []
......@@ -51,6 +47,31 @@ function start(items_) {
levels = items.levels
numberOfLevel = levels.length
currentLocale = GCompris.ApplicationInfo.getVoicesLocale(GCompris.ApplicationSettings.locale)
/*: Translators: NOTE: Word list for crane activity.
Translate this into a list of 15–25 simple 3-letter
words separated by semi-colons. The words can only contain
lowercase ASCII letters (a–z). Example: cat;dog;win;red;yes
*/
words3Letters = qsTr("cat;dog;win;red;yes;big;box;air;arm;car;bus;fun;day;eat;hat;leg;ice;old;egg").split(';')
/*: Translators: NOTE: Word list for crane activity.
Translate this into a list of 10–20 simple 4-letter
words separated by semi-colons. The words can only contain
lowercase ASCII letters (a–z). Example: blue;best;good;area
*/
words4Letters = qsTr("blue;best;good;area;bell;coat;easy;farm;food;else;girl;give;hero;help;hour;sand;song").split(';')
/*: Translators: NOTE: Word list for crane activity.
Translate this into a list of 10–20 simple 5-letter
words separated by semi-colons. The words can only contain
lowercase ASCII letters (a–z). Example: happy;child;white;apple
*/
words5Letters = qsTr("happy;child;white;apple;brown;truth;fresh;green;horse;hotel;house;paper;shape;shirt;study").split(';')
Core.shuffle(words3Letters)
Core.shuffle(words4Letters)
Core.shuffle(words5Letters)
initLevel()
}
......@@ -73,7 +94,7 @@ function initSubLevel() {
// set models for repeaters
if (!levels[currentLevel][currentSubLevel].isWord)
setRandomModelImage()
setModelImage()
else
setModelWord()
......@@ -101,11 +122,32 @@ function initSubLevel() {
}
}
function getInternalWord(){
// function to get a word from translated lists
var currentWordLength = levels[currentLevel][currentSubLevel].wordLength
var wordsUsed
if (currentWordLength == 3) {
wordsUsed = words3Letters
}
else if (currentWordLength == 4) {
wordsUsed = words4Letters
}
else if (currentWordLength == 5) {
wordsUsed = words5Letters
}
// choosing first word of a list and pushing it to the end of the list like a queue.
var word = wordsUsed[0]
wordsUsed.shift()
wordsUsed.push(word)
return word
}
// levels with words as items
function setModelWord() {
var numbers = []
var i
var wordsUsed
var word = levels[currentLevel][currentSubLevel].word
// show or hide the grid
items.showGrid1.opacity = levels[currentLevel][currentSubLevel].showGrid
......@@ -122,10 +164,9 @@ function setModelWord() {
numbers[i] = i; // generate columns*rows numbers
}
// before: // var currentIndex = currentLevel % numberLevelsWords
// get a word
var word = levels[currentLevel][currentSubLevel].word
if(word === undefined) {
word = getInternalWord()
}
// place the word at a random position in the grid
var randomRow = Math.floor(Math.random() * items.rows)
......@@ -158,9 +199,10 @@ function setModelWord() {
}
// levels with images as items
function setRandomModelImage() {
function setModelImage() {
var numbers = []
var i
var imageList = levels[currentLevel][currentSubLevel].images;
// set the number of columns and rows from "levels"
items.columns = levels[currentLevel][currentSubLevel].columns
......@@ -173,18 +215,18 @@ function setRandomModelImage() {
}
// randomize the names
Core.shuffle(allNames)
Core.shuffle(imageList)
//get "levels[currentLevel].noOfItems" random numbers
Core.shuffle(numbers)
for (i = 0; i < levels[currentLevel][currentSubLevel].noOfItems; i++)
names[numbers[i]] = url + allNames[i]
for (i = 0; i < imageList.length; i++)
names[numbers[i]] = imageList[i]
Core.shuffle(numbers)
for (i = 0; i < levels[currentLevel][currentSubLevel].noOfItems; i++)
names2[numbers[i]] = url + allNames[i]
for (i = 0; i < imageList.length; i++)
names2[numbers[i]] = imageList[i]
// set model for repeaters
items.repeater.model = names.length
......
......@@ -21,45 +21,62 @@
import GCompris 1.0
Data {
objective: qsTr("Play with smaller grids of size 3x4.")
objective: qsTr("Play with Images.")
difficulty: 2
property var images: [
"qrc:/gcompris/src/activities/crane/resource/bulb.svg",
"qrc:/gcompris/src/activities/crane/resource/letter-a.svg",
"qrc:/gcompris/src/activities/crane/resource/letter-b.svg",
"qrc:/gcompris/src/activities/crane/resource/rectangle1.svg",
"qrc:/gcompris/src/activities/crane/resource/rectangle2.svg",
"qrc:/gcompris/src/activities/crane/resource/square1.svg",
"qrc:/gcompris/src/activities/crane/resource/square2.svg",
"qrc:/gcompris/src/activities/crane/resource/triangle1.svg",
"qrc:/gcompris/src/activities/crane/resource/triangle2.svg",
"qrc:/gcompris/src/activities/crane/resource/tux.svg",
"qrc:/gcompris/src/activities/crane/resource/water_drop1.svg",
"qrc:/gcompris/src/activities/crane/resource/water_drop2.svg",
"qrc:/gcompris/src/activities/crane/resource/water_spot1.svg",
"qrc:/gcompris/src/activities/crane/resource/water_spot2.svg"
]
data: [
[
{
"isWord": true,
"word": qsTr("cat"),
"isWord": false,
"images": images.slice(0,2),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("dog"),
"isWord": false,
"images": images.slice(3,5),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("egg"),
"isWord": false,
"images": images.slice(6,8),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("win"),
"isWord": false,
"images": images.slice(9,11),
"showGrid": true,
"inLine": false,
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("day"),
"isWord": false,
"images": images.slice(11,13),
"showGrid": true,
"inLine": false,
"rows": 3,
......@@ -69,127 +86,127 @@ Data {
[
{
"isWord": false,
"noOfItems": 2,
"images": images.slice(0,3),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 3,
"images": images.slice(2,4),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 3,
"images": images.slice(5,8),
"showGrid": true,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 4,
"images": images.slice(9,11),
"showGrid": true,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 5,
"images": images.slice(10,13),
"showGrid": true,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 4,
"columns": 5
}
],
[
{
"isWord": true,
"word": qsTr("red"),
"isWord": false,
"images": images.slice(0,3),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("big"),
"isWord": false,
"images": images.slice(2,5),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("air"),
"isWord": false,
"images": images.slice(3,6),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("box"),
"isWord": false,
"images": images.slice(6,9),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("ant"),
"isWord": false,
"images": images.slice(9,13),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 5,
"columns": 6
}
],
[
{
"isWord": false,
"noOfItems": 2,
"images": images.slice(0,4),
"showGrid": false,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 3,
"images": images.slice(2,7),
"showGrid": false,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 3,
"images": images.slice(4,9),
"showGrid": false,
"inLine": true,
"rows": 3,
"columns": 4
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 4,
"images": images.slice(5,11),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 5,
"images": images.slice(6,13),
"showGrid": false,
"inLine": false,
"rows": 3,
"columns": 4
"rows": 6,
"columns": 7
}
]
]
......
......@@ -21,87 +21,90 @@
import GCompris 1.0
Data {
objective: qsTr("Play with smaller grids of size 4x5.")
objective: qsTr("Play with words of 3 letters.")
difficulty: 3
data: [
[
/* To add your words, replace "wordLength" key with "word".
Example - replace "wordLength": 3 with "word": qsTr("happy")
*/
{
"isWord": true,
"word": qsTr("pen"),
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("area"),
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("good"),
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("best"),
"wordLength": 3,
"showGrid": true,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 3,
"columns": 4
},
{
"isWord": true,
"word": qsTr("coat"),
"wordLength": 3,
"showGrid": true,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 3,
"columns": 4
}
],
[
{
"isWord": false,
"noOfItems": 3,
"isWord": true,
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 4,
"isWord": true,
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 5,
"isWord": true,
"wordLength": 3,
"showGrid": true,
"inLine": true,
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 6,
"isWord": true,
"wordLength": 3,
"showGrid": true,
"inLine": false,
"rows": 4,
"columns": 5
},
{
"isWord": false,
"noOfItems": 7,
"isWord": true,
"wordLength": 3,
"showGrid": true,
"inLine": false,
"rows": 4,
......@@ -111,85 +114,85 @@ Data {
[
{
"isWord": true,
"word": qsTr("cap"),
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("bell"),
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("easy"),
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("girl"),
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 5,
"columns": 6
},
{
"isWord": true,
"word": qsTr("food"),
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 5,
"columns": 6
}
],
[
{
"isWord": false,
"noOfItems": 3,
"isWord": true,
"wordLength": 3,
"showGrid": false,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 4,
"isWord": true,
"wordLength": 3,
"showGrid": false,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 5,
"isWord": true,
"wordLength": 3,
"showGrid": false,
"inLine": true,
"rows": 4,
"columns": 5
"rows": 6,
"columns": 7
},
{
"isWord": false,
"noOfItems": 6,
"isWord": true,
"wordLength": 3,
"showGrid": false,
"inLine": false,
"rows": 4,
"columns": 5
"rows": 6,
"columns": 7