| 1 |
**Includes - Guess24.** activity |
| 2 |
|
| 3 |
[[_TOC_]] |
| 4 |
|
| 5 |
# Development notes |
| 6 |
|
| 7 |
## Data |
| 8 |
|
| 9 |
The [4 numbers](https://www.4nums.com/game/) site provides data on all possible solutions. |
| 10 |
I used this [table](https://www.4nums.com/solutions/allsolutions/) to get problems with valid solutions. |
| 11 |
And this other [table](https://www.4nums.com/game/difficulties/) which gives statistics on the success rate and average solution time. |
| 12 |
These data come from a population of Internet users who are probably adults. |
| 13 |
|
| 14 |
These data are in the files `tools/Guess24-solutions.csv` and `tools/Guess24-difficulty.csv`. They are not used in the activity but are used to generate |
| 15 |
`guess24.json`. |
| 16 |
|
| 17 |
## Data problem |
| 18 |
|
| 19 |
Some solutions require an intermediate result in the form of a fraction (read this [page](https://www.4nums.com/solutions/fractions/)). |
| 20 |
Example: **2 3 5 12** has the unique solution **12/(3-5/2)**, which is not at the level of a primary school pupil. |
| 21 |
|
| 22 |
## Preparing the data |
| 23 |
|
| 24 |
The data milling script is written in `php`. This language can be used with the command line and is available in all Linux distributions. |
| 25 |
It prepares the data but is not useful for running the activity. |
| 26 |
|
| 27 |
### build-datas.php |
| 28 |
|
| 29 |
* Use it in the `guess24/tools/` directory: `$ php build-datas.php`. |
| 30 |
* It reads the two `.csv` files to extract useful data. |
| 31 |
* And selects problems according to these rules: |
| 32 |
|
| 33 |
* Eliminates solutions with a fractional intermediate result. |
| 34 |
* Eliminates solutions with an average resolution rate below a certain threshold (variable `$limitRate`). |
| 35 |
* Classifies problems into three complexity categories: |
| 36 |
|
| 37 |
**1**: problems with at least one solution containing only addition and/or subtraction. |
| 38 |
**2**: problems with at least one solution containing one multiplication. |
| 39 |
**3**: problems with division required. |
| 40 |
**4**: problems with lower solved rate. |
| 41 |
|
| 42 |
This script produces the file `resource/guess24.json` and outputs a report to the terminal : |
| 43 |
|
| 44 |
Problems with a solved rate greater than 80% |
| 45 |
-------------------- |
| 46 |
Complexity 1: 217 problems |
| 47 |
Complexity 2: 742 problems |
| 48 |
Complexity 3: 118 problems |
| 49 |
Complexity 4: 233 problems |
| 50 |
Total: 1310 problems |
| 51 |
-------------------- |
| 52 |
Output file: ../resource/guess24.json |
| 53 |
Output file size: 173673 bytes |
| 54 |
103 solutions rejected for a rational intermediate result |
| 55 |
|
| 56 |
`php build-datas.php --help` gives the possibles options: |
| 57 |
|
| 58 |
Usage: php build-datas.php [OPTIONS] |
| 59 |
Create file `guess24/resource/guess24.json` from `Guess24-difficulty.csv` and `Guess24-solutions.csv`. |
| 60 |
Print a report on stdout. |
| 61 |
|
| 62 |
Options |
| 63 |
-v, --verbose print information on rejected formulas. |
| 64 |
-s, --solutions no solutions in output file. |
| 65 |
-r, --rate [LIMITRATE] set minimum solved rate required (default 80). |
| 66 |
-h, --help display this help and exit. |
| 67 |
|
| 68 |
Extract from `resource/guess24.json` : |
| 69 |
|
| 70 |
[ |
| 71 |
{ |
| 72 |
"puzzle": "1 1 12 12", |
| 73 |
"solutions": [ |
| 74 |
"12+12+1-1" |
| 75 |
], |
| 76 |
"complexity": 1 |
| 77 |
}, |
| 78 |
{ |
| 79 |
"puzzle": "1 1 2 6", |
| 80 |
"solutions": [ |
| 81 |
"(1+1)*6*2", |
| 82 |
"(2+1+1)*6" |
| 83 |
], |
| 84 |
"complexity": 2 |
| 85 |
}, |
| 86 |
{ |
| 87 |
"puzzle": "1 1 2 11", |
| 88 |
"solutions": [ |
| 89 |
"11*2+1+1", |
| 90 |
"(1+1)*11+2", |
| 91 |
"(11+1)*2*1" |
| 92 |
], |
| 93 |
"complexity": 2 |
| 94 |
} |
| 95 |
] |
| 96 |
|
| 97 |
The data weight 170Kb. |
| 98 |
Removing the solutions brings it down to 70Kb. |
| 99 |
|
| 100 |
To get the smallest file: `$ php build-datas.php -s -c` |
| 101 |
|
| 102 |
## Levels of difficulty. |
| 103 |
|
| 104 |
The `Data.qml` files contain three pieces of data: |
| 105 |
|
| 106 |
data: [ |
| 107 |
{ |
| 108 |
"count": 20, |
| 109 |
"complexities": [ 2, 3 ], |
| 110 |
"operatorsCount": 4 |
| 111 |
} |
| 112 |
] |
| 113 |
|
| 114 |
`complexities` is the list of desired `complexities` in the level (from 1 to 3). |
| 115 |
`operatorsCount` controls the number of operators displayed (in order `+`, `-`, `×`, `÷`). |
| 116 |
|
| 117 |
The difficulty levels use complexities as follows: |
| 118 |
|
| 119 |
**1** Uses complexity 1 problems (217 problems) |
| 120 |
**2** Uses problems of complexity 1 and 2 (217 + 742 problems) |
| 121 |
**3** Uses complexity 2 problems (742 problems) |
| 122 |
**4** Uses complexity 2 and 3 problems (742 + 118 problems) |
| 123 |
**5** Uses complexity 3 problems (118 problems) |
| 124 |
|
| 125 |
In the example above, the activity will randomly select a list of 20 problems from the 860 possibles (742 + 118). |
| 126 |
|
| 127 |
## Interface |
| 128 |
|
| 129 |
I was inspired by this site: [Y8](https://fr.y8.com/games/make_24). |
| 130 |
|
| 131 |
Negative or fractional intermediate results are rejected by a small animation. |
| 132 |
|
| 133 |
Keyboard interface: |
| 134 |
|
| 135 |
* Arrows to move from one value to another. |
| 136 |
* Space, Return or Enter to select the next value. |
| 137 |
* The +, -, * and / keys for arithmetic operations. |