From 105eb86b850cd2aae07b1144e5f7cb425cf7c063 Mon Sep 17 00:00:00 2001 From: djib Date: Mon, 2 Jan 2006 17:40:32 +0000 Subject: [PATCH] Testing the XBoardProtocol : this version only answers to 'quit', 'e2e4' and 'd2d4'. BUG? When using with XBoard, error saying 'broken pipe' after the first move... --- src/TestXBoardProtocol.java | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/TestXBoardProtocol.java diff --git a/src/TestXBoardProtocol.java b/src/TestXBoardProtocol.java new file mode 100644 index 0000000..724fd97 --- /dev/null +++ b/src/TestXBoardProtocol.java @@ -0,0 +1,36 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; + +/** + * + */ + +/** + * @author djib + * This class is used to test the XBoard protocol. + * + */ +public class TestXBoardProtocol { + public static void main(String[] args) { + BufferedReader xBoardInput = new BufferedReader(new InputStreamReader(System.in)); + + while (true) { + try { + String xBoardCommand = xBoardInput.readLine(); + //System.err.println(xBoardCommand); + if (xBoardCommand.startsWith("quit")) { + break; + } + if (xBoardCommand.startsWith("e2e4")) { + System.out.println("move b8c6"); + } + if (xBoardCommand.startsWith("d2d4")) { + System.out.println("move d7d5"); + } + + } catch (Exception err) { + break; + } + } + } +}