- Text interface: removed uses of the 'n' command with a negative argument

This commit is contained in:
Olivier Teulière 2009-01-24 17:43:57 +00:00
parent 4ffaef3e1d
commit 7fc8309868
7 changed files with 35 additions and 35 deletions

View file

@ -9,7 +9,8 @@ a t
a s a s
a l a l
a gd a gd
n -1 h p
h r
a g a g
a gd a gd
q q

View file

@ -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] 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] 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] 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 commande> a g
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
A - - - - - - - - - - - - - - - A - - - - - - - - - - - - - - -

View file

@ -6,7 +6,8 @@ r
n 1 n 1
a gd # c2 a gd # c2
n -1 h p
h r
a gd # c3 a gd # c3
t EUOFMIE t EUOFMIE
@ -24,7 +25,8 @@ r
n 1 n 1
a gd # c6 a gd # c6
n -1 h p
h r
a gd # c7 a gd # c7
q q

View file

@ -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] 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] 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>
commande> n -1 commande> h p
commande> h r
commande> a gd # c3 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] 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] 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] 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] 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>
commande> n -1 commande> h p
commande> h r
commande> a gd # c7 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] 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] 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]

View file

@ -1,5 +1,6 @@
c rosace c rosace
n -13 h p 13
h r
a P a P
a t a t
a l a l

View file

@ -3,7 +3,8 @@ Using seed: 0
commande> c rosace commande> c rosace
mode entraînement mode entraînement
[?] pour l'aide [?] pour l'aide
commande> n -13 commande> h p 13
commande> h r
commande> a P commande> a P
Eliot Eliot

View file

@ -1,7 +1,8 @@
/***************************************************************************** /*****************************************************************************
* Copyright (C) 2005 Eliot * Eliot
* Authors: Antoine Fraboulet <antoine.fraboulet@free.fr> * Copyright (C) 2005-2008 Antoine Fraboulet & Olivier Teulière
* Olivier Teuliere <ipkiss@via.ecp.fr> * Authors: Antoine Fraboulet <antoine.fraboulet @@ free.fr>
* Olivier Teulière <ipkiss @@ gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -380,12 +381,21 @@ void commonCommands(PublicGame &iGame, const vector<wstring> &tokens)
else if (tokens[0][0] == L'h') else if (tokens[0][0] == L'h')
{ {
const wstring &action = checkAlphaToken(tokens, 1); const wstring &action = checkAlphaToken(tokens, 1);
wstring count = checkNumToken(tokens, 2);
if (count == L"")
count = L"1";
if (action == L"" || action.size() != 1) if (action == L"" || action.size() != 1)
return; return;
if (action[0] == L'p') 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') 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') else if (action[0] == L'f')
iGame.firstTurn(); iGame.firstTurn();
else if (action[0] == L'l') else if (action[0] == L'l')
@ -624,20 +634,8 @@ void loopTraining(PublicGame &iGame)
{ {
int n = _wtoi(num.c_str()); int n = _wtoi(num.c_str());
if (n <= 0) if (n <= 0)
{ printf("mauvais argument\n");
if (n == 0) iGame.trainingPlayResult(n - 1);
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");
}
} }
} }
break; break;
@ -1018,24 +1016,18 @@ void mainLoop(const Dictionary &iDic)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
string dicPath;
// Let the user choose the locale // Let the user choose the locale
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
if (argc != 2 && argc != 3) 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); exit(1);
} }
else
{
dicPath = argv[1];
}
try try
{ {
Dictionary dic(dicPath); Dictionary dic(argv[1]);
unsigned int seed; unsigned int seed;
if (argc == 3) if (argc == 3)