diff --git a/src/activities/lightsoff/ActivityInfo.qml b/src/activities/lightsoff/ActivityInfo.qml index dbaa59f07..3e39f6bdb 100644 --- a/src/activities/lightsoff/ActivityInfo.qml +++ b/src/activities/lightsoff/ActivityInfo.qml @@ -1,39 +1,40 @@ /* GCompris - ActivityInfo.qml * * Copyright (C) 2015 Stephane Mankowski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import GCompris 1.0 ActivityInfo { name: "lightsoff/Lightsoff.qml" difficulty: 6 icon: "lightsoff/lightsoff.svg" author: "Stephane Mankowski <stephane@mankowski.fr>" //: Activity title title: qsTr("Lights Off") //: Help title description: qsTr("The aim is to switch off all the lights.") // intro: "Click on the lamps to turn them off." //: Help goal goal: qsTr("The aim is to switch off all the lights.") //: Help prerequisite prerequisite: "" //: Help manual manual: qsTr("The effect of pressing a window is to toggle the state of that window, and of its immediate vertical and horizontal neighbors. The sun and the color of the sky depend on the number of clicks needed to solve the puzzle. If you click on Tux, the solution is shown.") credit: qsTr("The solver algorithm is described on Wikipedia. To know more about the Lights Off game: <https://en.wikipedia.org/wiki/Lights_Out_(game)>") section: "discovery logic" createdInVersion: 0 + levels: "1,2,3,4,5,6,7,8,9" } diff --git a/src/activities/lightsoff/Lightsoff.qml b/src/activities/lightsoff/Lightsoff.qml index 51155a231..f2a7378fd 100644 --- a/src/activities/lightsoff/Lightsoff.qml +++ b/src/activities/lightsoff/Lightsoff.qml @@ -1,249 +1,273 @@ /* GCompris - lightsoff.qml * * Copyright (C) 2014 Stephane Mankowski * * Authors: * Bruno Coudoin (GTK+ version) * Stephane Mankowski (Qt Quick port) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ import QtQuick 2.6 +import GCompris 1.0 import "../../core" import "lightsoff.js" as Activity ActivityBase { id: activity onStart: focus = true onStop: { } pageComponent: Rectangle { id: background color: "blue" anchors.fill: parent signal start signal stop property bool keyNavigationVisible: false Component.onCompleted: { + dialogActivityConfig.initialize() activity.start.connect(start) activity.stop.connect(stop) } // Add here the QML items you need to access in javascript QtObject { id: items property Item main: activity.main property alias background: background property alias bar: bar property alias bonus: bonus property alias skyColor: background.color property alias modelTable: modelTable + property var levels: activity.datasetLoader.data property bool blockClicks: false property int nbCell: 5 property int cellSize: Math.min( (parent.height - 200) / items.nbCell, (parent.width - 40) / items.nbCell) property int nbCelToWin: 0 } onStart: { Activity.start(items) } onStop: { Activity.stop() } Keys.enabled: !items.blockClicks Keys.onPressed: { background.keyNavigationVisible = true if (event.key === Qt.Key_Left) grid.moveCurrentIndexLeft() if (event.key === Qt.Key_Right) grid.moveCurrentIndexRight() if (event.key === Qt.Key_Down) grid.moveCurrentIndexDown() if (event.key === Qt.Key_Up) grid.moveCurrentIndexUp() if (event.key === Qt.Key_Space || event.key === Qt.Key_Enter || event.key === Qt.Key_Return) Activity.windowPressed(grid.currentIndex) } /* The background picture */ Image { source: Activity.url + "back.svg" anchors.bottom: parent.bottom fillMode: Image.TileHorizontally sourceSize.height: (parent.height - (gridarea.y + gridarea.height)) * 1.2 z: 2 } Image { source: Activity.url + "building.svg" fillMode: Image.PreserveAspectFit anchors.fill: gridarea anchors.margins: -1 * Math.ceil(items.nbCell / 2) * items.cellSize z: 2 } Image { source: Activity.url + "front.svg" anchors.bottom: parent.bottom fillMode: Image.TileHorizontally sourceSize.height: 20 + tux.height * 0.5 z: 999 } /* The sun */ Image { id: sun source: Activity.url + "sun.svg" sourceSize.height: items.cellSize * 2 * items.nbCell / 5 anchors { left: parent.left leftMargin: 10 bottom: parent.bottom bottomMargin: parent.height / 3 + 2 / 3 * parent.height * items.nbCelToWin / (items.nbCell * items.nbCell) } z: 1 Behavior on anchors.bottomMargin { PropertyAnimation { duration: 1000 } } } /* Tux */ BarButton { id: tux fillMode: Image.PreserveAspectFit source: Activity.url + "tux.svg" sourceSize.width: parent.width - grid.width < 200 ? bar.height * 1.2 : Math.min((parent.width - grid.width - 40) / 2, 150) z: 3 visible: true anchors { right: parent.right rightMargin: 20 bottom: parent.bottom bottomMargin: 20 } onClicked: Activity.solve() } /* The grid */ Rectangle { id: gridarea anchors.fill: grid anchors.margins: items.cellSize / -10 opacity: 0 z: 4 } GridView { id: grid anchors.top: parent.top anchors.topMargin: (parent.height - height) / 6 anchors.horizontalCenter: parent.horizontalCenter width: items.nbCell * items.cellSize height: width cellWidth: items.cellSize cellHeight: items.cellSize z: 5 ListModel { id: modelTable } model: modelTable delegate: Rectangle { color: "transparent" height: items.cellSize width: items.cellSize border { color: soluce === 1 ? "red" : "transparent" width: items.cellSize / 40 } radius: items.cellSize / 10 BarButton { anchors.fill: parent fillMode: Image.PreserveAspectFit source: Activity.url + "off.svg" sourceSize.height: items.cellSize mouseArea.hoverEnabled: !items.blockClicks mouseArea.enabled: !items.blockClicks onClicked: Activity.windowPressed(index) visible: true Image { anchors.fill: parent fillMode: Image.PreserveAspectFit source: Activity.url + "on.svg" opacity: lighton === 1 ? 1 : 0 sourceSize.height: items.cellSize Behavior on opacity { PropertyAnimation { duration: 200 } } } } } interactive: false keyNavigationWraps: true highlightFollowsCurrentItem: true highlight: Rectangle { width: items.cellSize height: items.cellSize color: "#AAFFFFFF" radius: items.cellSize / 10 visible: background.keyNavigationVisible Behavior on x { SpringAnimation { spring: 2; damping: 0.2 } } Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } } } } DialogHelp { id: dialogHelp onClose: home() } + DialogChooseLevel { + id: dialogActivityConfig + currentActivity: activity.activityInfo + + onSaveData: { + levelFolder = dialogActivityConfig.chosenLevels + currentActivity.currentLevels = dialogActivityConfig.chosenLevels + ApplicationSettings.setCurrentLevels(currentActivity.name, dialogActivityConfig.chosenLevels) + } + onClose: { + home() + } + onStartActivity: { + background.stop() + background.start() + } + } + Bar { id: bar content: BarEnumContent { - value: help | home | level | reload + value: help | home | level | reload | activityConfig } onHelpClicked: { displayDialog(dialogHelp) } onPreviousLevelClicked: Activity.previousLevel() onNextLevelClicked: Activity.nextLevel() onHomeClicked: activity.home() onReloadClicked: Activity.initLevel() + onActivityConfigClicked: { + displayDialog(dialogActivityConfig) + } } Bonus { id: bonus onStop: items.blockClicks = false Component.onCompleted: win.connect(Activity.nextLevel) } } } diff --git a/src/activities/lightsoff/lightsoff.js b/src/activities/lightsoff/lightsoff.js index 2df2d3aaa..5812af1a4 100644 --- a/src/activities/lightsoff/lightsoff.js +++ b/src/activities/lightsoff/lightsoff.js @@ -1,268 +1,155 @@ /* GCompris - lightsoff.js * * Copyright (C) 2014 Stephane Mankowski * * Authors: * Bruno Coudoin (GTK+ version) * Stephane Mankowski (Qt Quick port) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -var levels = [[0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], // 1 - [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // 1 soluce - [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1], // 52 soluce - [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1], // 53 - [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0], // 53 soluce - [1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], // 54 - [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1], // 54 soluce - [1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0], // 55 - [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0], // 55 soluce - [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], // 56 - [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0], // 56 soluce - [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0], // 57 - [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0]] // 57 soluce - +var levels var currentLevel = 0 -var numberOfLevel = 100 +var numberOfLevel var items var table var soluc var showSoluce = false var size = 5 var url = "qrc:/gcompris/src/activities/lightsoff/resource/" function start(items_) { items = items_ currentLevel = 0 + numberOfLevel = items.levels.length initLevel() } function stop() {} function initLevel() { items.bar.level = currentLevel + 1 /* Is it a static or dynamic level ? */ - if (currentLevel >= levels.length / 2) { + if (items.levels[currentLevel].dynamic) { /* Dynamic */ - size=Math.min(Math.floor((currentLevel+1)/10), 9) + size = items.levels[currentLevel].size table = new Array(size * size) soluc = new Array(size * size) for (var i = 0; i < size * size; ++i) { table[i] = 0 soluc[i] = 0 } for (var j = 0; j < currentLevel; ++j) { switchLightNoCheck(Math.floor(size * size * Math.random())) } } else { /* Static */ - size = 5 - table = levels[currentLevel * 2].slice(0) - soluc = levels[currentLevel * 2 + 1].slice(0) + size = items.levels[currentLevel].size + table = items.levels[currentLevel].level.slice(0) + soluc = items.levels[currentLevel].solution.slice(0) } showSoluce = false items.modelTable.clear() items.nbCell = size refreshModel() checkResult() } function nextLevel() { if (numberOfLevel <= ++currentLevel) { currentLevel = 0 } initLevel() } function previousLevel() { if (--currentLevel < 0) { currentLevel = numberOfLevel - 1 } initLevel() } function switchLightNoCheck(index) { /* Switch the selected item */ table[index] = 1 - table[index] - /* Swith the soluce */ + /* Switch the soluce */ soluc[index] = 1 - soluc[index] /* Switch neighbor left */ if (index % size !== 0) table[index - 1] = 1 - table[index - 1] /* Switch neighbor right */ if (index % size !== size - 1) table[index + 1] = 1 - table[index + 1] /* Switch neighbor up */ if (index > size - 1) table[index - size] = 1 - table[index - size] /* Switch neighbor down */ if (index < size * size -size) table[index + size] = 1 - table[index + size] } function refreshModel() { for (var i = 0; i < size * size; ++i) { items.modelTable.set(i, { 'lighton': table[i], 'soluce': showSoluce ? soluc[i] : 0}) } } function switchLight(index) { /* Switch the selected item */ switchLightNoCheck(index) /* Refresh the lights */ refreshModel() /* Check the result */ checkResult() } function checkResult() { /* Check the result */ var nb = 0 table.forEach(function (entry) { nb += entry }) if (nb === 0) { - items.blockClicks = true + items.blockClicks = true items.bonus.good("tux") } /* Check the soluce */ items.nbCelToWin = nb items.skyColor = Qt.rgba(0, (127 - 127 * (size * size - nb) / (size * size)) / 255, (255 - 255 * (size * size - nb) / (size * size)) / 255, 1) } function solve() { showSoluce = !showSoluce /* Refresh the lights */ refreshModel() } function windowPressed(index) { audioEffects.play('qrc:/gcompris/src/core/resource/sounds/scroll.wav') switchLight(index) } diff --git a/src/activities/lightsoff/resource/1/Data.qml b/src/activities/lightsoff/resource/1/Data.qml new file mode 100644 index 000000000..7c2fca421 --- /dev/null +++ b/src/activities/lightsoff/resource/1/Data.qml @@ -0,0 +1,58 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("5*5 grids, Very easy") + difficulty: 3 + data: [ + { // 1 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], + "solution": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + }, + { // 2 + "size": 5, + "level": [1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "solution": [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + }, + { // 3 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], + "solution": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0] + }, + { // 4 + "size": 5, + "level": [1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1], + "solution": [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] + }, + { // 5 + "size": 5, + "level": [0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0], + "solution": [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0] + }, + { // 6 + "size": 5, + "level": [1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1], + "solution": [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1] + } + ] +} diff --git a/src/activities/lightsoff/resource/2/Data.qml b/src/activities/lightsoff/resource/2/Data.qml new file mode 100644 index 000000000..1926d9c4d --- /dev/null +++ b/src/activities/lightsoff/resource/2/Data.qml @@ -0,0 +1,58 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("5*5 grids, Easy") + difficulty: 4 + data: [ + { // 1 + "size": 5, + "level": [0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1], + "solution": [0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1] + }, + { // 2 + "size": 5, + "level": [1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0], + "solution": [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1] + }, + { // 3 + "size": 5, + "level": [1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], + "solution": [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0] + }, + { // 4 + "size": 5, + "level": [1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1], + "solution": [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1] + }, + { // 5 + "size": 5, + "level": [0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0], + "solution": [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0] + }, + { // 6 + "size": 5, + "level": [1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0], + "solution": [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0] + } + ] +} diff --git a/src/activities/lightsoff/resource/3/Data.qml b/src/activities/lightsoff/resource/3/Data.qml new file mode 100644 index 000000000..f05872f3e --- /dev/null +++ b/src/activities/lightsoff/resource/3/Data.qml @@ -0,0 +1,88 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("5*5 grids, Medium") + difficulty: 5 + data: [ + { // 1 + "size": 5, + "level": [0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0], + "solution": [1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0] + }, + { // 2 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], + "solution": [0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1] + }, + { // 3 + "size": 5, + "level": [0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0], + "solution": [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1] + }, + { // 4 + "size": 5, + "level": [1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1], + "solution": [0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0] + }, + { // 5 + "size": 5, + "level": [1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0], + "solution": [0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0] + }, + { // 6 + "size": 5, + "level": [1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1], + "solution": [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1] + }, + { // 7 + "size": 5, + "level": [0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1], + "solution": [1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1], + }, + { // 8 + "size": 5, + "level": [1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1], + "solution": [1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1] + }, + { // 9 + "size": 5, + "level": [0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0], + "solution": [0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1] + }, + { // 10 + "size": 5, + "level": [0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0], + "solution": [1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0] + }, + { // 11 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1], + "solution": [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1] + }, + { // 12 + "size": 5, + "level": [0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0], + "solution": [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0] + } + ] +} diff --git a/src/activities/lightsoff/resource/4/Data.qml b/src/activities/lightsoff/resource/4/Data.qml new file mode 100644 index 000000000..b426252c5 --- /dev/null +++ b/src/activities/lightsoff/resource/4/Data.qml @@ -0,0 +1,118 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("5*5 grids, Difficult") + difficulty: 5 + data: [ + { // 1 + "size": 5, + "level": [1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1], + "solution": [0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0] + }, + { // 2 + "size": 5, + "level": [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], + "solution": [1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0] + }, + { // 3 + "size": 5, + "level": [0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0], + "solution": [1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0] + }, + { // 4 + "size": 5, + "level": [0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1], + "solution": [1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0] + }, + { // 5 + "size": 5, + "level": [1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0], + "solution": [1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1] + }, + { // 6 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1], + "solution": [1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1] + }, + { // 7 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0], + "solution": [1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0] + }, + { // 8 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], + "solution": [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1] + }, + { // 9 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], + "solution": [1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0] + }, + { // 10 + "size": 5, + "level": [1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1], + "solution": [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1] + }, + { // 11 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0], + "solution": [0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0] + }, + { // 12 + "size": 5, + "level": [1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0], + "solution": [0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0] + }, + { // 13 + "size": 5, + "level": [0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1], + "solution": [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0] + }, + { // 14 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1], + "solution": [0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1] + }, + { // 15 + "size": 5, + "level": [1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0], + "solution": [1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1] + }, + { // 16 + "size": 5, + "level": [0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0], + "solution": [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0] + }, + { // 17 + "size": 5, + "level": [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0], + "solution": [1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1] + }, + { // 18 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], + "solution": [1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0] + } + ] +} diff --git a/src/activities/lightsoff/resource/5/Data.qml b/src/activities/lightsoff/resource/5/Data.qml new file mode 100644 index 000000000..b7e091d49 --- /dev/null +++ b/src/activities/lightsoff/resource/5/Data.qml @@ -0,0 +1,111 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("5*5 grids, Very Difficult") + difficulty: 6 + data: [ + { // 1 + "size": 5, + "level": [1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1], + "solution": [0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0] + }, + { // 2 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "solution": [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0] + }, + { // 3 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1], + "solution": [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0] + }, + { // 4 + "size": 5, + "level": [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0], + "solution": [1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0] + }, + { // 5 + "size": 5, + "level": [1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1], + "solution": [1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0] + }, + { // 6 + "size": 5, + "level": [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0], + "solution": [0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1] + }, + { // 7 + "size": 5, + "level": [0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0], + "solution": [1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0] + }, + { // 8 + "size": 5, + "level": [1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1], + "solution": [1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1] + }, + { // 9 + "size": 5, + "level": [0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0], + "solution": [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0] + }, + { // 10 + "size": 5, + "level": [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1], + "solution": [0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0] + }, + { // 11 + "size": 5, + "level": [0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0], + "solution": [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1] + }, + { // 12 + "size": 5, + "level": [1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], + "solution": [0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1] + }, + { // 13 + "size": 5, + "level": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "solution": [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1] + }, + { // 14 + "size": 5, + "level": [1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1], + "solution": [1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1] + }, + { // 15 + "size": 5, + "level": [1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], + "solution": [1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1] + }, + { // 16 + "size": 5, + "dynamic": true + }, + { // 17 + "size": 5, + "dynamic": true + } + ] +} diff --git a/src/activities/lightsoff/resource/6/Data.qml b/src/activities/lightsoff/resource/6/Data.qml new file mode 100644 index 000000000..961b8581a --- /dev/null +++ b/src/activities/lightsoff/resource/6/Data.qml @@ -0,0 +1,68 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("6*6 grids, Very Difficult") + difficulty: 6 + data: [ + { // 1 + "size": 6, + "dynamic": true + }, + { // 2 + "size": 6, + "dynamic": true + }, + { // 3 + "size": 6, + "dynamic": true + }, + { // 4 + "size": 6, + "dynamic": true + }, + { // 5 + "size": 6, + "dynamic": true + }, + { // 6 + "size": 6, + "dynamic": true + }, + { // 7 + "size": 6, + "dynamic": true + }, + { // 8 + "size": 6, + "dynamic": true + }, + { // 9 + "size": 6, + "dynamic": true + }, + { // 10 + "size": 6, + "dynamic": true + } + ] +} diff --git a/src/activities/lightsoff/resource/7/Data.qml b/src/activities/lightsoff/resource/7/Data.qml new file mode 100644 index 000000000..8300ea6d7 --- /dev/null +++ b/src/activities/lightsoff/resource/7/Data.qml @@ -0,0 +1,68 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("7*7 grids, Very Difficult") + difficulty: 6 + data: [ + { // 1 + "size": 7, + "dynamic": true + }, + { // 2 + "size": 7, + "dynamic": true + }, + { // 3 + "size": 7, + "dynamic": true + }, + { // 4 + "size": 7, + "dynamic": true + }, + { // 5 + "size": 7, + "dynamic": true + }, + { // 6 + "size": 7, + "dynamic": true + }, + { // 7 + "size": 7, + "dynamic": true + }, + { // 8 + "size": 7, + "dynamic": true + }, + { // 9 + "size": 7, + "dynamic": true + }, + { // 10 + "size": 7, + "dynamic": true + } + ] +} diff --git a/src/activities/lightsoff/resource/8/Data.qml b/src/activities/lightsoff/resource/8/Data.qml new file mode 100644 index 000000000..d8c094f00 --- /dev/null +++ b/src/activities/lightsoff/resource/8/Data.qml @@ -0,0 +1,68 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("8*8 grids, Very Difficult") + difficulty: 6 + data: [ + { // 1 + "size": 8, + "dynamic": true + }, + { // 2 + "size": 8, + "dynamic": true + }, + { // 3 + "size": 8, + "dynamic": true + }, + { // 4 + "size": 8, + "dynamic": true + }, + { // 5 + "size": 8, + "dynamic": true + }, + { // 6 + "size": 8, + "dynamic": true + }, + { // 7 + "size": 8, + "dynamic": true + }, + { // 8 + "size": 8, + "dynamic": true + }, + { // 9 + "size": 8, + "dynamic": true + }, + { // 10 + "size": 8, + "dynamic": true + } + ] +} diff --git a/src/activities/lightsoff/resource/9/Data.qml b/src/activities/lightsoff/resource/9/Data.qml new file mode 100644 index 000000000..d37f8feff --- /dev/null +++ b/src/activities/lightsoff/resource/9/Data.qml @@ -0,0 +1,68 @@ +/* GCompris - Data.qml + * + * Copyright (C) 2020 Johnny Jazeix + * + * Authors: + * Johnny Jazeix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ +import GCompris 1.0 + +Data { + objective: qsTr("9*9 grids, Very Difficult") + difficulty: 6 + data: [ + { // 1 + "size": 9, + "dynamic": true + }, + { // 2 + "size": 9, + "dynamic": true + }, + { // 3 + "size": 9, + "dynamic": true + }, + { // 4 + "size": 9, + "dynamic": true + }, + { // 5 + "size": 9, + "dynamic": true + }, + { // 6 + "size": 9, + "dynamic": true + }, + { // 7 + "size": 9, + "dynamic": true + }, + { // 8 + "size": 9, + "dynamic": true + }, + { // 9 + "size": 9, + "dynamic": true + }, + { // 10 + "size": 9, + "dynamic": true + } + ] +}