mirror of
https://github.com/Cpt-Adok/SNAKE.git
synced 2026-01-25 09:34:06 +00:00
programme testé
This commit is contained in:
@@ -33,7 +33,7 @@ public class QTable {
|
|||||||
private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
private ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur de la classe QTabl cree le HashMap qValues.
|
* Constructeur de la classe QTable cree le HashMap qValues.
|
||||||
*/
|
*/
|
||||||
public QTable() {
|
public QTable() {
|
||||||
qValues = new HashMap<>();
|
qValues = new HashMap<>();
|
||||||
@@ -161,9 +161,7 @@ public class QTable {
|
|||||||
for (File partFile : listFiles) {
|
for (File partFile : listFiles) {
|
||||||
executor.submit(() -> {
|
executor.submit(() -> {
|
||||||
try {
|
try {
|
||||||
// Charger chaque fichier dans un HashMap temporaire
|
|
||||||
HashMap<Actions, Double> tempMap = getChunkSave(partFile.getPath());
|
HashMap<Actions, Double> tempMap = getChunkSave(partFile.getPath());
|
||||||
// Ajouter chaque entrée au ConcurrentHashMap
|
|
||||||
multithreadHashMap.putAll(tempMap);
|
multithreadHashMap.putAll(tempMap);
|
||||||
} catch (ClassNotFoundException | IOException e) {
|
} catch (ClassNotFoundException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -54,17 +54,38 @@ public class QTableTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void getRealInformation() {
|
public static void getRealInformation() {
|
||||||
State state = new State(new Grid[3][3], new ArrayList<>(Arrays.asList(new int[] {1, 1})));
|
// State state = new State(new Grid[3][3], new ArrayList<>(Arrays.asList(new int[] {1, 1})));
|
||||||
Mouvement mouvement = Mouvement.GAUCHE;
|
// Mouvement mouvement = Mouvement.GAUCHE;
|
||||||
|
|
||||||
QTable qTableSend = new QTable();
|
// QTable qTableSend = new QTable();
|
||||||
QTable qTableReceived = new QTable();
|
// QTable qTableReceived = new QTable();
|
||||||
|
|
||||||
qTableSend.setQValue(state, mouvement, 102.0);
|
// qTableSend.setQValue(state, mouvement, 102.0);
|
||||||
qTableSend.save(path, "fromage");
|
// qTableSend.save(path, "fromage");
|
||||||
|
|
||||||
try {qTableReceived.get(path, "fromage");} catch(ClassNotFoundException | IOException e) {e.printStackTrace();}
|
// try {qTableReceived.get(path, "fromage");} catch(ClassNotFoundException | IOException e) {e.printStackTrace();}
|
||||||
System.out.println(qTableReceived.getQValue(state, mouvement));
|
// System.out.println(qTableReceived.getQValue(state, mouvement));
|
||||||
|
|
||||||
|
QTable.folderStorage = 1;
|
||||||
|
|
||||||
|
QTable qTable = new QTable();
|
||||||
|
|
||||||
|
for(int i = 0; i<10000; i++) {
|
||||||
|
qTable.setQValue(new State(new Grid[3][3], new ArrayList<>(Arrays.asList(new int[] {i, 1}))), Mouvement.BAS, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
qTable.save("res/save/", "file");
|
||||||
|
|
||||||
|
QTable qTable2 = new QTable();
|
||||||
|
|
||||||
|
try {
|
||||||
|
qTable2.get("res/save/", "file");
|
||||||
|
} catch (ClassNotFoundException | IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
qTable2.printHashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user