Shogi Engine

Problem #470  

Tags: games interactive c-1

Who solved this?

No translations... yet

This game is still being tested - but you are welcome to try it (and thus help to test).

Here comes the second part of the problem about creating automated player for chess-like game. You are to play against server (and win).

Game rules are described in the previous task Game of Generals. Now you already should have a code which generates the list of moves for the given position. Just implement simple recursive minimax algorithm to pick the best move (I suppose you'll need to employ alpha-beta pruning improvement to match the performance requirements - but nothing more complicated).

It is an interactive problem, so please check instructions by this link and use shogi for game name in the url.

Send the first request simply containing the new token you got as input. Response will have the board set for you - the field state will contain SFEN notation of the current position (after each request).

From this moment you'll make next move with each next request. Add field sente for this (meaning "first player") - it should describe your move in the same way as in Game of Generals - though spaces are optional.

Server may ponder on its move for up to 5 seconds. You in your turn may spend as much time as you want, for example when playing manually, but to solve the puzzle you need to ensure that every your move is made in no more than 10 seconds.

Server answers with the field gote - containing the move of your opponent. There'll be additional fields which you may find helpful.

Example:

curl http://<server-url>/shogi.php -d 'token=...'


state: kcxrvh/pppppp/6/6/PPPPPP/HVRXCK b 
board: 
 k c x r v h    [  ]
 p p p p p p 
 - - - - - - 
 - - - - - - 
 P P P P P P 
 H V R X C K    [  ]


curl http://<server-url>/shogi.php -d 'token=...&sente=2232'


deltaTime: 15
gote: 5 1 4 1
state: kcxrvh/1ppppp/p5/1P4/P1PPPP/HVRXCK b 
board: 
 k c x r v h    [  ]
 - p p p p p 
 p - - - - - 
 - P - - - - 
 P - P P P P 
 H V R X C K    [  ]
You need to login to get test data and submit solution.