Ataxx

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Ataxx

Post by Ferdy »

flok wrote: Sat Oct 19, 2019 11:57 pm
flok wrote: Thu Oct 17, 2019 7:14 pm
flok wrote: Thu Oct 17, 2019 8:28 am
Joost Buijs wrote: Thu Oct 17, 2019 8:11 am Thanks! I understand Maybe fun to get something running.
I've put up the source-code at https://github.com/flok99/waxx if someone wants to add authentication or maybe run a server at home.
Ok I've implemented auth.
The first time you connect with an not-yet-known username, then that is automatically registered with the password you supply.

So, connect to server.ataxx.org port 28028 and send
user ...
pass ...
then regular UAI protocol commences.
On http://server.ataxx.org/ you can see the results of all that battling.
Is there a gui viewer for the output pgn?
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

hgm wrote: Fri Oct 18, 2019 8:02 pm This is an XBoard patch that makes it possible to use XBoard for Ataxx. It implements two things:

1) With argument -variant atx one enables 'Ataxx mode' where every enemy surrounding the to-square of a move will flip color.
2) With argument -dropMenu true, and if the pieceToCharTable only contains a single piece type (like -pieceToCharTable ".X.....o...."), a right-click on a square will not pop up a menu for selecting the piece you want to drop there, but drops it immediately. This allows you to play the 1-step moves as drops on the to-square by a simple right-click.

Code: Select all

diff --git a/backend.c b/backend.c
index b6088f6..c44f5e8 100644
--- a/backend.c
+++ b/backend.c
@@ -400,6 +400,7 @@ PosFlags (int index)
   case VariantLosers:
     flags |= F_MANDATORY_CAPTURE; //[HGM] losers: sets flag so TestLegality rejects non-capts if capts exist
     break;
+  case VariantAtaxx:
   case VariantAtomic:
     flags |= F_IGNORE_CHECK | F_ATOMIC_CAPTURE;
     break;
@@ -1257,6 +1258,7 @@ InitBackEnd1 ()
 			         and doesn't know captures are mandatory */
       case VariantTwoKings:   /* should work */
       case VariantAtomic:     /* should work except for win condition */
+      case VariantAtaxx:      /* should work except for win condition */
       case Variant3Check:     /* should work except for win condition */
       case VariantShatranj:   /* should work except for all win conditions */
       case VariantMakruk:     /* should work except for draw countdown */
@@ -8085,7 +8087,7 @@ Deselect ()
 int
 RightClick (ClickType action, int x, int y, int *fromX, int *fromY)
 {   // front-end-free part taken out of PieceMenuPopup
-    int whichMenu; int xSqr, ySqr;
+    int whichMenu; int xSqr, ySqr, n, i, t, side;
 
     if(seekGraphUp) { // [HGM] seekgraph
 	if(action == Press)   SeekGraphClick(Press, x, y, 2); // 2 indicates right-click: no pop-down on miss
@@ -8181,11 +8183,15 @@ RightClick (ClickType action, int x, int y, int *fromX, int *fromY)
 	if(gameMode == TwoMachinesPlay || gameMode == AnalyzeMode ||
            gameMode == AnalyzeFile || gameMode == IcsObserving) return -1;
       case EditGame:
+      case BeginningOfGame:
       noZip:
 	if (xSqr < 0 || ySqr < 0) return -1;
 	if (!appData.dropMenu || appData.testLegality &&
 	    gameInfo.variant != VariantBughouse &&
 	    gameInfo.variant != VariantCrazyhouse) return -1;
+        n = t = 0; side = (currentMove & 1)*BlackPawn;
+	for(i=WhitePawn; i<BlackPawn; i++) if(PieceToChar(i + side) != '.') n++, t = i + side;
+	if(n == 1) whichMenu = 5; else
 	whichMenu = 1; // drop menu
 	break;
       default:
@@ -8202,6 +8208,7 @@ RightClick (ClickType action, int x, int y, int *fromX, int *fromY)
     else
       *fromY = BOARD_HEIGHT - 1 - *fromY;
 
+    if(whichMenu == 5) DropMenuEvent(t, *fromX, *fromY), whichMenu = -2; // only one type; choose it
     return whichMenu;
 }
 
@@ -10744,7 +10751,8 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board)
           board[handSize-1-p][0] = WHITE_TO_BLACK captured;
 	}
       }
-    } else if (gameInfo.variant == VariantAtomic) {
+    }
+    if (gameInfo.variant == VariantAtomic) {
       if (captured != EmptySquare) {
 	int y, x;
 	for (y = toY-1; y <= toY+1; y++) {
@@ -10757,6 +10765,17 @@ ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board)
 	}
 	board[toY][toX] = EmptySquare;
       }
+    } else if (gameInfo.variant == VariantAtaxx) {
+	int y, x;
+	for (y = toY-1; y <= toY+1; y++) {
+	  for (x = toX-1; x <= toX+1; x++) {
+            if (y >= 0 && y < BOARD_HEIGHT && x >= BOARD_LEFT && x < BOARD_RGHT && (x != toX || y != toY)) {
+              if(board[toY][toX] >= BlackPawn) {
+                if(board[y][x] < BlackPawn) board[y][x] += BlackPawn;
+	      } else if(board[y][x] >= BlackPawn && board[y][x] < EmptySquare) board[y][x] -= BlackPawn;
+	    }
+	  }
+	}
     }
 
     if(gameInfo.variant == VariantSChess && promoChar != NULLCHAR && promoChar != '=' && piece != WhitePawn && piece != BlackPawn) {
@@ -15980,6 +15999,7 @@ DropMenuEvent (ChessSquare selection, int x, int y)
 	moveType = BlackDrop;
 	break;
       case EditGame:
+      case BeginningOfGame:
 	moveType = WhiteOnMove(currentMove) ? WhiteDrop : BlackDrop;
 	break;
       default:
diff --git a/common.h b/common.h
index 55daf29..6fb73d9 100644
--- a/common.h
+++ b/common.h
@@ -414,6 +414,7 @@ typedef enum {
     VariantASEAN,
     VariantLion,
     VariantChuChess,
+    VariantAtaxx,
     VariantUnknown       /* Catchall for other unknown variants */
 } VariantClass;
 
@@ -464,6 +465,7 @@ typedef enum {
   "asean",\
   "lion",\
   "elven",\
+  "atx",\
   "unknown" \
 }
 
The remaining configuring can be done by existing XBoard options (and can also be done by the engine through a 'setup' command):

xboard -variant atx -ncp -dropMenu true -pieceToCharTable ".X.....o...." -boardWidth 7 -boardHeight 7 -fen "X5o/7/7/7/7/7/o5X w" =men "X:mAmD@;o:mAmD@"

Of course you can also redefine the piece graphics to more suitable images through -pieceImageDirectory.
I had to replace "=men" by "-men" to get it to start.
Works almost complete: I could not do single-moves though.
Also "paste game" fails for ataxx games: http://server.ataxx.org/get-pgn.php?id= ... ed82fd9fcc
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

Ferdy wrote: Sun Oct 20, 2019 12:02 pm
flok wrote: Sat Oct 19, 2019 11:57 pm
flok wrote: Thu Oct 17, 2019 7:14 pm
flok wrote: Thu Oct 17, 2019 8:28 am
Joost Buijs wrote: Thu Oct 17, 2019 8:11 am Thanks! I understand Maybe fun to get something running.
I've put up the source-code at https://github.com/flok99/waxx if someone wants to add authentication or maybe run a server at home.
Ok I've implemented auth.
The first time you connect with an not-yet-known username, then that is automatically registered with the password you supply.

So, connect to server.ataxx.org port 28028 and send
user ...
pass ...
then regular UAI protocol commences.
On http://server.ataxx.org/ you can see the results of all that battling.
Is there a gui viewer for the output pgn?
Not yet afaik but people are working on it!
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Ataxx

Post by hgm »

Well, there is Win/XBoard, but it would not read this crappy move format. And the FENs are also not compliant with FEN rules.
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

hgm wrote: Sun Oct 20, 2019 11:06 pm Well, there is Win/XBoard, but it would not read this crappy move format.
What is crappy about the move format? It's no more crappy than saying something like 1. e4 in chess instead of always saying 1. e2e4, isn't it?
And the FENs are also not compliant with FEN rules.
Well it is a different game?
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Ataxx

Post by hgm »

It is crappy to describe something as a move with an implied side effect when the board mutation really is a simple drop. Standard notation for adding a piece to the board on e4 is X@e4. Not e3e4, d4e4 or whatever. And FENs are supposed to use upper case or white, no matter what game they are for, or they just aren't FENs.
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

Ferdy wrote: Sun Oct 20, 2019 12:02 pmIs there a gui viewer for the output pgn?
There now is one!

If you go to http://server.ataxx.org/, then in the table at the bottom a column "view" was added. If you click that one, then you can view a game.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Ataxx

Post by Ferdy »

flok wrote: Tue Oct 22, 2019 6:03 pm
Ferdy wrote: Sun Oct 20, 2019 12:02 pmIs there a gui viewer for the output pgn?
There now is one!

If you go to http://server.ataxx.org/, then in the table at the bottom a column "view" was added. If you click that one, then you can view a game.
Not working at the moment. There is no move list.

Image
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

Ferdy wrote: Wed Oct 23, 2019 4:03 am
flok wrote: Tue Oct 22, 2019 6:03 pm
Ferdy wrote: Sun Oct 20, 2019 12:02 pmIs there a gui viewer for the output pgn?
There now is one!

If you go to http://server.ataxx.org/, then in the table at the bottom a column "view" was added. If you click that one, then you can view a game.
Not working at the moment. There is no move list.

Image
Fixed!

See e.g. https://server.ataxx.org/viewer.html?ur ... 5968f3319a
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: Ataxx

Post by Ferdy »

flok wrote: Wed Oct 23, 2019 8:15 am
Ferdy wrote: Wed Oct 23, 2019 4:03 am
flok wrote: Tue Oct 22, 2019 6:03 pm
Ferdy wrote: Sun Oct 20, 2019 12:02 pmIs there a gui viewer for the output pgn?
There now is one!

If you go to http://server.ataxx.org/, then in the table at the bottom a column "view" was added. If you click that one, then you can view a game.
Not working at the moment. There is no move list.

Image
Fixed!

See e.g. https://server.ataxx.org/viewer.html?ur ... 5968f3319a
Thanks.
Would be better if the pieces are more visible.
Image

I use chrome on windows 7.