Skip to content
Snippets Groups Projects
Commit d88d0fa7 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '22-improve-manage-data-script' into 'master'

Resolve "Improve manage data script"

Closes #22

See merge request !22
parents 80f7f971 fdfe03e7
No related branches found
No related tags found
1 merge request!22Resolve "Improve manage data script"
Pipeline #5570 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.19
app.versionCode=19
app.versionName=0.0.20
app.versionCode=20
Improve data and management script.
Améliorations des données et du script de gestion.
......@@ -73,7 +73,7 @@ class GameData {
"ABEILLE": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["liquide"]
"na": []
},
"AMPOULE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -128,7 +128,7 @@ class GameData {
"CANARD": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["liquide"]
"na": []
},
"CASQUETTE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -158,7 +158,7 @@ class GameData {
"CONFITURE": {
"is": ["artificiel", "inerte", "solide"],
"isnot": ["gazeux", "liquide", "naturel", "vivant"],
"na": ["liquide"]
"na": []
},
"CORDE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -178,12 +178,12 @@ class GameData {
"FENÊTRE": {
"is": ["artificiel", "inerte", "solide"],
"isnot": ["gazeux", "liquide", "naturel", "vivant"],
"na": ["liquide"]
"na": []
},
"FOURMI": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["liquide"]
"na": []
},
"FUSÉE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -218,7 +218,7 @@ class GameData {
"LICORNE": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["naturel"]
"na": []
},
"LIVRE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -238,7 +238,7 @@ class GameData {
"NOEUD": {
"is": ["artificiel", "inerte"],
"isnot": ["gazeux", "liquide", "naturel", "vivant"],
"na": ["artificiel", "solide"]
"na": ["solide"]
},
"ORAGE": {
"is": ["inerte", "naturel"],
......@@ -348,7 +348,7 @@ class GameData {
"TORTUE": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["liquide"]
"na": []
},
"TROMPETTE": {
"is": ["artificiel", "inerte", "solide"],
......@@ -358,7 +358,7 @@ class GameData {
"VACHE": {
"is": ["naturel", "solide", "vivant"],
"isnot": ["artificiel", "gazeux", "inerte", "liquide"],
"na": ["liquide"]
"na": []
},
"VOILIER": {
"is": ["artificiel", "inerte", "solide"],
......
......@@ -3,7 +3,7 @@ description: A sorting game application.
publish_to: 'none'
version: 0.0.19+19
version: 0.0.20+20
environment:
sdk: '^3.0.0'
......
......@@ -99,9 +99,7 @@
"inerte",
"liquide"
],
"na": [
"liquide"
]
"na": []
},
"AMPOULE": {
"is": [
......@@ -255,9 +253,7 @@
"inerte",
"liquide"
],
"na": [
"liquide"
]
"na": []
},
"CASQUETTE": {
"is": [
......@@ -342,9 +338,7 @@
"naturel",
"vivant"
],
"na": [
"liquide"
]
"na": []
},
"CORDE": {
"is": [
......@@ -401,9 +395,7 @@
"naturel",
"vivant"
],
"na": [
"liquide"
]
"na": []
},
"FOURMI": {
"is": [
......@@ -417,9 +409,7 @@
"inerte",
"liquide"
],
"na": [
"liquide"
]
"na": []
},
"FUSÉE": {
"is": [
......@@ -518,9 +508,7 @@
"inerte",
"liquide"
],
"na": [
"naturel"
]
"na": []
},
"LIVRE": {
"is": [
......@@ -577,7 +565,6 @@
"vivant"
],
"na": [
"artificiel",
"solide"
]
},
......@@ -895,9 +882,7 @@
"inerte",
"liquide"
],
"na": [
"liquide"
]
"na": []
},
"TROMPETTE": {
"is": [
......@@ -925,9 +910,7 @@
"inerte",
"liquide"
],
"na": [
"liquide"
]
"na": []
},
"VOILIER": {
"is": [
......
......@@ -67,6 +67,25 @@ function clean_item_mappings(array $itemMappings)
$itemMappings['isnot'] = array_clean($itemMappings['isnot']);
$itemMappings['na'] = array_clean($itemMappings['na']);
// remove duplicates
$itemMappings['is'] = array_clean($itemMappings['is']);
$tmpArray = [];
foreach (array_clean($itemMappings['isnot']) as $itemIsNot) {
if (!\in_array($itemIsNot, $itemMappings['is'])) {
$tmpArray[] = $itemIsNot;
}
}
$itemMappings['isnot'] = $tmpArray;
$tmpArray = [];
foreach (array_clean($itemMappings['na']) as $itemNa) {
if (!\in_array($itemNa, $itemMappings['is']) && !\in_array($itemNa, $itemMappings['isnot'])) {
$tmpArray[] = $itemNa;
}
}
$itemMappings['na'] = $tmpArray;
return $itemMappings;
}
......@@ -133,7 +152,7 @@ foreach ($items as $item) {
}
// TODO: Should check/add unkown items from current mapping
\ksort($mappingItems);
$data['mapping'] = [
'items' => $mappingItems,
];
......@@ -315,15 +334,17 @@ $exitMainLoop = false;
while ($exitMainLoop === false) {
dump('');
$missing = find_missing_associations($mappingItems, $categories, $items);
$menu = [
'0: exit',
'',
'1: show categories',
'2: show items',
'3: show exclusions',
'4: show mappings',
'1: show categories (' . \count($categories) . ' found)',
'2: show items (' . \count($items) . ' found)',
'3: show exclusions (' . \count($exclusions) . ' found)',
'4: show mappings (' . \count($mappingItems) . ' found)',
'',
'5: edit mappings',
'5: complete mappings (' . \count($missing) . ' missing)',
];
$answer = ask(\join("\n", $menu));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment