gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] `undo' and `gg-undo' GTP commands improvements


From: Paul Pogonyshev
Subject: [gnugo-devel] `undo' and `gg-undo' GTP commands improvements
Date: Fri, 9 Apr 2004 17:18:58 +0300
User-agent: KMail/1.6.50

- don't try to undo when stackp is not zero

GTP specification mandates "cannot undo" message.  Since this is
mostly meant to prevent assertion failure after accidential `undo'
instead of `popgo', message doesn't matter a lot.

Paul



--- play_gtp.c.~1.142.~ 2004-02-12 23:29:58.000000000 +0200
+++ play_gtp.c  2004-04-09 17:15:51.000000000 +0300
@@ -2753,7 +2753,7 @@ gtp_undo(char *s)
 {
   UNUSED(s);
 
-  if (!undo_move(1))
+  if (stackp > 0 || !undo_move(1))
     return gtp_failure("cannot undo");
 
   reset_engine();
@@ -2778,7 +2778,7 @@ gtp_gg_undo(char *s)
   if (number_moves < 0)
     return gtp_failure("can't undo a negative number of moves");
 
-  if (!undo_move(number_moves))
+  if (stackp > 0 || !undo_move(number_moves))
     return gtp_failure("cannot undo");
 
   reset_engine();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]