Warning, /education/gcompris/src/activities/guess24/tools/README.md is written in an unsupported language. File is not indexed.

0001 **Includes - Guess24.** activity
0002 
0003 [[_TOC_]]
0004 
0005 # Development notes
0006 
0007 ## Data
0008 
0009 The [4 numbers](https://www.4nums.com/game/) site provides data on all possible solutions.
0010 I used this [table](https://www.4nums.com/solutions/allsolutions/) to get problems with valid solutions.
0011 And this other [table](https://www.4nums.com/game/difficulties/) which gives statistics on the success rate and average solution time.
0012 These data come from a population of Internet users who are probably adults.
0013 
0014 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
0015 `guess24.json`.
0016 
0017 ## Data problem
0018 
0019 Some solutions require an intermediate result in the form of a fraction (read this [page](https://www.4nums.com/solutions/fractions/)).
0020 Example: **2 3 5 12** has the unique solution **12/(3-5/2)**, which is not at the level of a primary school pupil.
0021 
0022 ## Preparing the data
0023 
0024 The data milling script is written in `php`. This language can be used with the command line and is available in all Linux distributions.
0025 It prepares the data but is not useful for running the activity.
0026 
0027 ### build-datas.php
0028 
0029 * Use it in the `guess24/tools/` directory: `$ php build-datas.php`.
0030 * It reads the two `.csv` files to extract useful data.
0031 * And selects problems according to these rules:
0032 
0033     * Eliminates solutions with a fractional intermediate result.
0034     * Eliminates solutions with an average resolution rate below a certain threshold (variable `$limitRate`).
0035     * Classifies problems into three complexity categories:
0036     
0037         **1**: problems with at least one solution containing only addition and/or subtraction.
0038         **2**: problems with at least one solution containing one multiplication.
0039         **3**: problems with division required.
0040 
0041 This script produces the file `resource/guess24.json` and outputs a report to the terminal :
0042 
0043     Problems with a solved rate greater than 80%
0044     --------------------
0045     Complexity 1: 217 problems
0046     Complexity 2: 742 problems
0047     Complexity 3: 118 problems
0048     Total: 1077 problems
0049     --------------------
0050     Output file: ../resource/guess24.json
0051     Output file size: 173673 bytes
0052     103 solutions rejected for a rational intermediate result
0053 
0054 `php build-datas.php --help` gives the possibles options:
0055 
0056     Usage: php build-datas.php [OPTIONS]
0057     Create file `guess24/resource/guess24.json` from `Guess24-difficulty.csv` and `Guess24-solutions.csv`.
0058     Print a report on stdout.
0059     
0060     Options
0061       -v, --verbose              print informations on rejected formulas.
0062       -s, --solutions            no solutions in output file.
0063       -r, --rate [LIMITRATE]     set minimum solved rate required (default 80).
0064       -h, --help                 display this help and exit.
0065 
0066 Extract from `resource/guess24.json` :
0067 
0068     [
0069         {
0070             "puzzle": "1 1 12 12",
0071             "solutions": [
0072                 "12+12+1-1"
0073             ],
0074             "complexity": 1
0075         },
0076         {
0077             "puzzle": "1 1 2 6",
0078             "solutions": [
0079                 "(1+1)*6*2",
0080                 "(2+1+1)*6"
0081             ],
0082             "complexity": 2
0083         },
0084         {
0085             "puzzle": "1 1 2 11",
0086             "solutions": [
0087                 "11*2+1+1",
0088                 "(1+1)*11+2",
0089                 "(11+1)*2*1"
0090             ],
0091             "complexity": 2
0092         }
0093     ]
0094 
0095 The data weight 170Kb.
0096 Removing the solutions brings it down to 70Kb.
0097 
0098 To get the smallest file: `$ php build-datas.php -s -c`
0099 
0100 ## Levels of difficulty.
0101 
0102 The `Data.qml` files contain three pieces of data:
0103 
0104     data: [
0105         {
0106             "count": 20,
0107             "complexities": [ 2, 3 ],
0108             "operatorsCount": 4
0109         }
0110     ]
0111 
0112 `complexities` is the list of desired `complexities` in the level (from 1 to 3).
0113 `operatorsCount` controls the number of operators displayed (in order `+`, `-`, `×`, `÷`).
0114 
0115 The difficulty levels use complexities as follows:
0116 
0117   **1** Uses complexity 1 problems (217 problems)
0118   **2** Uses problems of complexity 1 and 2 (217 + 742 problems)
0119   **3** Uses complexity 2 problems (742 problems)
0120   **4** Uses complexity 2 and 3 problems (742 + 118 problems)
0121   **5** Uses complexity 3 problems (118 problems)
0122 
0123 In the example above, the activity will randomly select a list of 20 problems from the 860 possibles (742 + 118).
0124 
0125 ## Interface
0126 
0127 I was inspired by this site: [Y8](https://fr.y8.com/games/make_24).
0128 
0129 Negative or fractional intermediate results are rejected by a small animation.
0130 
0131 Keyboard interface:
0132 
0133   * Arrows to move from one value to another.
0134   * Space, Return or Enter to select the next value.
0135   * The +, -, * and / keys for arithmetic operations.