Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascending order activity #172

Closed
wants to merge 16 commits into from

Conversation

RudraNilBasu
Copy link
Contributor

Ascending order activity

Given few randomly generated numbers, user will have to click on the numbers in
ascending order.

Copy link
Member

@petitlapin petitlapin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I did remarks but there is a more global point to fix. The activity like that is not really interesting for children, It would be better to discuss it with the mailing list (there are teachers who can provide good advices on pedagogic values) to know how we can improve the quality of it.

Johnny

prerequisite: qsTr("Move a mouse and click on the correct place")
manual: qsTr("You are provided with few numbers. Click on the smallest number first, second smallest number second, and the largest number in the last")
credit: "openclipart.org"
section: qsTr("math")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have an exception for this line, you don't need the qsTr() here.
It also misses the createdInVersion value (8000)

*/
import QtQuick 2.1
import GCompris 1.0
import QtQuick.Window 2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this?

anchors {
horizontalCenter: parent.horizontalCenter
}
text: ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to initialize the value with the default value

property int scale_factor: Screen.pixelDensity/default_pix_density
Rectangle {
property int imageX: 0
width: 360/4 * ApplicationInfo.ratio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 is the model size?

Repeater {
id: boxes
model: 4
property int scale_factor: Screen.pixelDensity/default_pix_density
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

* Copyright (C) 2016 Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
*
* Authors:
* Bruno Coudoin <bruno.coudoin@gcompris.net> (GTK+ version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this line

}

function printSorted() {
for(var i=0;i<entered.length-1;i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a sort function in js directly

}
}
}
for(i=0;i<entered.length;i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use Array.join()

@allon49
Copy link
Contributor

allon49 commented Feb 13, 2017

Hi Rudra,

I had a look to your number ordering activity.
For me it is a very good idea.
Ordering activity is one of the most efficient activity to check if a kid has understood the decimal system (121 is bigger than 12 for example).
I tryed your activity and would like to suggest some improvments.

1- It should have a ok button for the kid to confirm when he is ready to validate.
2- Johnny found an application on the web which is exactly what I would like to see on gcompris. You can reproduce the behaviour using flow:

http://doc.qt.io/qt-4.8/qml-flow.html

3- There should be options like in the web application to match to different ages. You can have a look to divyam categorisation to see how he manages settings.

Good luck,

Emmanuel

Implemented draging and dropping of the blocks
and shifting of the other blocks to it's
correct position
Core changes are:
* The size of the Blocks are now scaling with the change in screen size
* the threshold distance changes with change in screen size
* the tiles are now aligned in the center of the screen
* the Rectangle containing the Flow resizes with change in screen size

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Previously, we could change the position of a tile even when
the tile (or some other tiles) are still animating, thus creating
conflicts in position. This is corrected by not accepting any
onPressed or onReleased signals while the animation is still going on

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Changed the instruction of the activity.
A possible bug was found when mouse input was taken into account
even when the animation was still going on. This problem was reflected
when the mouse was Released and the tile went to the previous
location. This was solved by accepting the onPressed action only
when the animation is over

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Previously, the mouse input was checked with whether the animations
are completed and whether the input is valid or not to determine
whether or not the current mouse input should be taken into
consideration.

Here, instead of doing that, the mouseArea is enabled and disabled
based on the value of the above two variables, which is also set
via the script with the following rules:

1. It is valid when the level starts
2. It is not valid when the ok button is pressed
3. It is valid again when the answer turns out to be the wrong one

This should be much more intuitive and bug free as far as working
with the mouse is concerned

Sigend-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Added source of the icon on README (from openclipart)

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Updated the manual of the ActivityInfo.qml

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
@RudraNilBasu
Copy link
Contributor Author

@petitlapin @allon49 In the ascending order activity:

  1. The items are moved by drag and drop to reposition the items
  2. The tiles are now shifted for repositioning instead of swapping the positions
  3. There is an ok button to allow the user to confirm when ready
  4. There are 4 levels each with 3 sub levels, the sub levels are of the same difficulty (difficulty in the form
    of number of tiles and the range of numbers)

@petitlapin
Copy link
Member

Hi,
globally it's good (I have to take a closer look at the code).
Can you add the sublevel score (Score item in the core folder)?
Also, click on next/previous should change the level (and reset the current sublevel).
I would put the ok button above the bar too, else when resizing, they override

Thank you,

Johnny

difficulty: 2
icon: "ascending_order/ascending_order.svg"
author: "Rudra Nil Basu &lt;rudra.nil.basu.1996@gmail.com&gt;"
demo: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this value should be true

demo: false
title: qsTr("Ascending Order")
description: qsTr("Arrange the given numbers in ascending order")
//intro: "click on the numbers in ascending order"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update this. It corresponds to the intro voice that should be listened to explain the activity.

goal: qsTr("arranging numbers in ascending order")
prerequisite: qsTr("Move, drag and drop using mouse")
manual: qsTr("You are provided with few numbers. Drag and Drop the numbers in it's correct position to reorder the numbers in ascending order")
credit: "openclipart.org"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is needed, we used the images in a lot of places.


import "../../core"
import "ascending_order.js" as Activity
import "qrc:/gcompris/src/core/core.js" as Core
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

@divyam3897
Copy link
Contributor

hi,
I faced one more issue while playing it, for the extreme numbers (corner ones) if I drag a number beyond them then number came back and it was placed at the required position only if a portion of it overlapped with the corner number. Shouldn't the number be placed ahead of it (at its desired position) in that case?

Thank you
Divyam Madaan

@RudraNilBasu
Copy link
Contributor Author

@divyam3897 hi, the numbers will change the position (and the others will shift back or front) only when one tile is placed over another tile (not exactly over, a minimum distance is maintained). In that case, the dragged number will occupy the position of the tile on which it was dragged and the rest of them will get shifted accordingly. So, if a tile is dragged to the extreme corner, it crosses the minimum distance and hence it comes back to the original position.

@divyam3897
Copy link
Contributor

I did a screenshot for some cases.

  1. http://pasteboard.co/EehVhPRf2.png In this I was able to produce a gap between the numbers which should not be the case? (was not always reproducible but occured at times)
  2. http://pasteboard.co/EejDEXNZv.png In this the tile (29 the one being dragged) is pretty close and maybe should not go back?

@RudraNilBasu
Copy link
Contributor Author

@divyam3897

  1. I didn't get the first case. Do the tiles remain in that way (separated by a space) after dropping a tile (after the mouse is released)? In that case is there any specific way by which it can be reproduced? Also, which number is being dragged in this case? Strange. This type of thing never actually occurred to me.

  2. This one is okay. The 29 tile should be placed over the 74 tile in order to change the positions. The minimum distance is less in this case because had there been another tile on the left of 74, then the 29 tile should have occupied that position. The aim is to place a tile over the tile where it should belong.

@allon49
Copy link
Contributor

allon49 commented Mar 1, 2017 via email

Added sub level score, which will display the current sublevel in which
the player is currently present.

Level changes: Previously on changing the levels from the arrow key,
the current sib level was getting incremented. As of now, on clicking
the left or right arrow keys, the current sub level is reset to zero
and the current level is decremented or incremented accordingly.
On winning, the current sub level is incremented.

The ok button is repositioned above the bar, so that it doesn't get
overriden by the bar when resized

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
@RudraNilBasu
Copy link
Contributor Author

@petitlapin Following changes were made:

  1. demo is set to true
  2. updated intro
  3. Removed credit and unused imports
  4. Added sub level score
  5. Click on next/previous changes the level, while updating current sub level to zero
  6. Repositioned ok button so that it doesn't get overridden by the bar.

@divyam3897
Copy link
Contributor

@allon49 yes, In one case the card returned back after the screenshot and in the other it stayed there, creating an empty place.
@RudraNilBasu The sublevel count also may need to be repositioned? It gets hidden in case of small screen size http://pasteboard.co/Ey6QDoCx7.png

The sub level score is moved to the top right corner
of the screen just after the instruction text to
avoid getting hidden under the bar when the screen
size is reduced

Signed-off by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
@RudraNilBasu
Copy link
Contributor Author

RudraNilBasu commented Mar 2, 2017 via email

property alias flow: flow
property alias container: container
property real ratio: ApplicationInfo.ratio
property Score score: score
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be an alias

demo: true
title: qsTr("Ascending Order")
description: qsTr("Arrange the given numbers in ascending order")
// intro: "arrange the numbers in ascending order by placing a number in it's correct position"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its


var currentLevel = 0
var numberOfLevel = 4
var currentSubLevel = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly use score.currentSubLevel

var currentLevel = 0
var numberOfLevel = 4
var currentSubLevel = 0
var numberOfSubLevel = 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly use score.numberOfSubLevels


var currentLevel = 0
var numberOfLevel = 4
var currentSubLevel = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should directly use Score currentSubLevel instead and remove the items.score.message assignment below


var currentLevel = 0
var numberOfLevel = 4
var currentSubLevel = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly use Score.currentSubLevel


var currentLevel = 0
var numberOfLevel = 4
var currentSubLevel = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can directly use the score for this instead of having 2 other variables

Used sub level from score instead of creating new variables.
Fixed typing error in ActivityInfo.qml and used alias for the
score in QObject

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Added arranging alphabetical order in it's ascending and descending
order. Number of sub levels is increased to 4, each containing 2
ascending and 2 descending ordering sub-levels

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
@RudraNilBasu
Copy link
Contributor Author

@petitlapin Following changes were made:

  • numberOfSublevels and currentSublevels are used from Score.qml instead of using extra variables.
  • Used alias in score in QtObject
  • Number of sublevels is increased to 4
  • Each sublevel contains 2 ascending and 2 descending order arrangements
  • Added alphabetical order arrangement

The copyright option was not properly filled
previously. It is now corrected with proper name
and email address

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Previously, the alphabets activity only contained a-z english
alphabets. Now, it allows translation for different languages

An array is maintained to store [qsTr("a")....qsTr("z")] and
a random value is chosen from the array and then placed in
the block

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
All the letters are now stored in the letters string separated
by "/". Few other fixes, including the problem with boxes not
changing positions when released on a nearby box

Signed-off-by: Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
@RudraNilBasu
Copy link
Contributor Author

RudraNilBasu commented May 15, 2017

@petitlapin I have changed the alphabets activity to support various languages other than english.
Also, for testing purposes, I have tested it by replacing

var letters = qsTr("a/b/c/d..../z")

with

var letters = qsTr("À/à/Â/â/Æ/æ/Ç/ç/È/è/É/é/Ê/ê/Ë/ë/Î/î/Ï/ï/Ô/ô/Œ/œ/Ù/ù/Û/û/Ü/ü/«/»/€/₣")

icon: "alphabetical_order/alphabetical_order.svg"
author: "Rudra Nil Basu &lt;rudra.nil.basu.1996@gmail.com&gt;"
demo: true
title: "Alphabetical Order"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qsTr()

goal: qsTr("arranging alphabets in ascending or descending order as instructed")
prerequisite: qsTr("Move, drag and drop using mouse")
manual: qsTr("You are provided with few alphabets. Drag and Drop the alphabets in its correct position to reorder the numbers in ascending or descending order as instructed")
section: "math"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reading

@@ -0,0 +1,30 @@
/* GCompris - alphabetical_order.qml
*
* Copyright (C) 2016 Rudra Nil Basu <rudra.nil.basu.1996@gmail.com>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017

}
}

function generateRandomNumbers() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to be renamed more generic

import "../../core"
import "../ascending_order"

Ascending_order {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camelCase (also for filename). Same for AlphabeticalOrder

}

function initLevel() {
ascendingOrder = items.score.currentSubLevel % 2 == 0 ? true : false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be checked on the mailing list (or at least with Emmanuel) but I wouldn't change every sublevel. It would not be efficient to understand the meaning behind ascending/descending order


if (mode == "alphabets") {
//: list containing all the characters separated by a "/"
var letters = qsTr("a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a help button showing the order could be nice.

@allon49
Copy link
Contributor

allon49 commented May 17, 2017

there are many things to be sorted
I think we should have three activities called sorting
1- numerical sorting
2- alphabetical sorting
3- measures sorting
in numerical one I would see it presented like in categorisation activity offering different categories to sort
1- > 1 to 9
2- 1-99
3- 1-999
4- 1-99999
5- 1-999 999 999
that would be for increase order.
Same thing for decrease order.
In french teaching system the first one is aimed to <6 years old
the second one 6-7 years old
then 8-9 then 9-10 etc.
We would have the same for decreasing
In measures we would be ordering km dm cm etc
size, weight, etc
then in alphabetical order
1- single letter a b c
2- two letters ab ac bc bg
3- real words plane - planning - planification

@petitlapin
Copy link
Member

@allon49 if we do like that, we need to think of other activities where it could be applied to (not for this PR but it could be in the improvements section). With one generic submenu, if we manage to load datasets easily, then we can think of having the difficulty for each category instead at activity level (which would not make sense on this case as the activity level is more global than only a 2 years old span).
For the real words, it would need a new specific dataset so for now, I guess it could be a future improvement.
The question is to know if we do a first version like the current one (so each level corresponds to a range and we have sublevels in it) or do we directly do the menu one (but it would need to be generic enough to be "easily" adapted to the activities that need it)?

@petitlapin
Copy link
Member

Merged in ascending_order branch to continue the work

@petitlapin petitlapin closed this Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants