Ataxx

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

Moderators: hgm, Rebel, chrisw

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

Re: Ataxx

Post by flok »

Joost Buijs wrote: Thu Oct 17, 2019 8:03 am What does the protocol looks like? If somebody want's to play he needs more information than the connection details alone.
Oops indeed.

The protocol is UAI which is the same as UCI with only a couple of minor changes.

I quote from www.ataxx.org:

Code: Select all

UAI
Usually Ataxx programs use the UAI protocol. UAI is a derivative of the UCI protocol (used for chess programs).
The changes are the format of the FEN-string, the format of the move-string, and the notation of the initialize-commands; that's it!

Where a chess program would respond to "uci", an Ataxx program listens for "uai" (it tells the program to use the UAI protocol).
To start a new game, the board sends "uainewgame".

Moves are in the format 'xy' or 'xy-xy'. E.g. "bestmove a2" or "bestmove a1b2". A pass is written as "bestmove 0000".

FEN strings (the textual representation of the board) is like in UCI: board-text turn halfmoves fullmoves. For a description, see this wikipedia-page.
The difference is that we only have two types of pieces - stones -: a red (white/player-1, 'o') and blue (black/player-2, 'x') one.
Joost Buijs
Posts: 1563
Joined: Thu Jul 16, 2009 10:47 am
Location: Almere, The Netherlands

Re: Ataxx

Post by Joost Buijs »

Thanks! I understand Maybe fun to get something running.
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

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.
Twipply
Posts: 9
Joined: Fri Dec 02, 2016 8:55 pm

Re: Ataxx

Post by Twipply »

I've been writing an Ataxx library in C++ for the last month or so. I think it should be fairly usable, so anyone is more than welcome to use it if they plan on writing an engine or anything else. https://github.com/kz04px/libataxx
Engine Programming on Discord -- https://discord.gg/invite/YctB2p4
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

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.
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

Twipply wrote: Thu Oct 17, 2019 3:04 pm I've been writing an Ataxx library in C++ for the last month or so. I think it should be fairly usable, so anyone is more than welcome to use it if they plan on writing an engine or anything else. https://github.com/kz04px/libataxx
I can confirm its usability and speed.
WOrks very well.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Ataxx

Post by hgm »

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.
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Ataxx

Post by flok »

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.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Ataxx

Post by hgm »

I don't get it. Which side of the UAI protocol does the server implement? The GUI side? But a GUI normally launches the engine. Engines won't connect by themselves to a remote server. Are you using some connection client between engine and socket, responsible for making the connection?
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 12:19 am I don't get it. Which side of the UAI protocol does the server implement? The GUI side? But a GUI normally launches the engine. Engines won't connect by themselves to a remote server. Are you using some connection client between engine and socket, responsible for making the connection?
Correct: in the source-code repositor of the server (https://github.com/flok99/Waxx) there is also a client.py. What it does is, connect to the server and authenticate. After that it pipes the data between the server and the engine. The engine thinks it talks to a gui.