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...
This commit is contained in:
36
src/TestXBoardProtocol.java
Normal file
36
src/TestXBoardProtocol.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user