diff --git a/test/training_cross2.input b/test/training_cross2.input index 71be6e6..ecf35be 100644 --- a/test/training_cross2.input +++ b/test/training_cross2.input @@ -9,7 +9,8 @@ a t a s a l a gd -n -1 +h p +h r a g a gd q diff --git a/test/training_cross2.ref b/test/training_cross2.ref index cefcc3f..ce81e2f 100644 --- a/test/training_cross2.ref +++ b/test/training_cross2.ref @@ -105,7 +105,8 @@ commande> a gd Mc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Nc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Oc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] -commande> n -1 +commande> h p +commande> h r commande> a g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A - - - - - - - - - - - - - - - diff --git a/test/training_cross3.input b/test/training_cross3.input index 360d10d..fe3b531 100644 --- a/test/training_cross3.input +++ b/test/training_cross3.input @@ -6,7 +6,8 @@ r n 1 a gd # c2 -n -1 +h p +h r a gd # c3 t EUOFMIE @@ -24,7 +25,8 @@ r n 1 a gd # c6 -n -1 +h p +h r a gd # c7 q diff --git a/test/training_cross3.ref b/test/training_cross3.ref index 64f6c5a..68139bb 100644 --- a/test/training_cross3.ref +++ b/test/training_cross3.ref @@ -72,7 +72,8 @@ commande> a gd # c2 Nc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Oc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] commande> -commande> n -1 +commande> h p +commande> h r commande> a gd # c3 Ar [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Br [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] @@ -214,7 +215,8 @@ commande> a gd # c6 Nc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Oc [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] commande> -commande> n -1 +commande> h p +commande> h r commande> a gd # c7 Ar [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] Br [ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1][ffffffff:-1] diff --git a/test/training_joker2.input b/test/training_joker2.input index c2aaa76..35f4656 100644 --- a/test/training_joker2.input +++ b/test/training_joker2.input @@ -1,5 +1,6 @@ c rosace -n -13 +h p 13 +h r a P a t a l diff --git a/test/training_joker2.ref b/test/training_joker2.ref index 4afdc74..840c4dc 100644 --- a/test/training_joker2.ref +++ b/test/training_joker2.ref @@ -3,7 +3,8 @@ Using seed: 0 commande> c rosace mode entraînement [?] pour l'aide -commande> n -13 +commande> h p 13 +commande> h r commande> a P Eliot diff --git a/utils/eliottxt.cpp b/utils/eliottxt.cpp index 23b9e0d..a553b7a 100644 --- a/utils/eliottxt.cpp +++ b/utils/eliottxt.cpp @@ -1,7 +1,8 @@ /***************************************************************************** - * Copyright (C) 2005 Eliot - * Authors: Antoine Fraboulet - * Olivier Teuliere + * Eliot + * Copyright (C) 2005-2008 Antoine Fraboulet & Olivier Teulière + * Authors: Antoine Fraboulet + * Olivier Teulière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -380,12 +381,21 @@ void commonCommands(PublicGame &iGame, const vector &tokens) else if (tokens[0][0] == L'h') { const wstring &action = checkAlphaToken(tokens, 1); + wstring count = checkNumToken(tokens, 2); + if (count == L"") + count = L"1"; if (action == L"" || action.size() != 1) return; if (action[0] == L'p') - iGame.prevTurn(); + { + for (int i = 0; i < _wtoi(count.c_str()); ++i) + iGame.prevTurn(); + } else if (action[0] == L'n') - iGame.nextTurn(); + { + for (int i = 0; i < _wtoi(count.c_str()); ++i) + iGame.nextTurn(); + } else if (action[0] == L'f') iGame.firstTurn(); else if (action[0] == L'l') @@ -624,20 +634,8 @@ void loopTraining(PublicGame &iGame) { int n = _wtoi(num.c_str()); if (n <= 0) - { - if (n == 0) - n = -1; - if ((unsigned int)-n > iGame.getHistory().getSize()) - throw GameException("Cannot go back that far"); - for (int i = 0; i < -n; ++i) - iGame.prevTurn(); - iGame.clearFuture(); - } - else - { - if (iGame.trainingPlayResult(--n)) - printf("mauvais argument\n"); - } + printf("mauvais argument\n"); + iGame.trainingPlayResult(n - 1); } } break; @@ -1018,24 +1016,18 @@ void mainLoop(const Dictionary &iDic) int main(int argc, char *argv[]) { - string dicPath; - // Let the user choose the locale setlocale(LC_ALL, ""); if (argc != 2 && argc != 3) { - fprintf(stdout, "Usage: eliot /chemin/vers/ods4.dawg [random_seed]\n"); + fprintf(stdout, "Usage: eliot /chemin/vers/ods5.dawg [random_seed]\n"); exit(1); } - else - { - dicPath = argv[1]; - } try { - Dictionary dic(dicPath); + Dictionary dic(argv[1]); unsigned int seed; if (argc == 3)