Adding simple logfiles to the Test Protocol.

The "broken pipe" bug seems to be inherent to XBoard because it does not happen with EBoard.
Apparently XBoard sends a SIGINT signal to the program !!!

Tiffany does not have this problem... why ?
This commit is contained in:
2006-01-03 16:22:01 +00:00
parent 105eb86b85
commit 88087a7069

View File

@ -1,9 +1,6 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
*/
import java.util.logging.*;
/**
* @author djib
@ -12,23 +9,45 @@ import java.io.InputStreamReader;
*/
public class TestXBoardProtocol {
public static void main(String[] args) {
Logger logger = Logger.getLogger("");
try {
FileHandler logFile = new FileHandler("%t/TestXBoardProtocol.txt");
logFile.setFormatter(new SimpleFormatter());
logger.addHandler(logFile);
} catch (Exception e) {
}
BufferedReader xBoardInput = new BufferedReader(new InputStreamReader(System.in));
while (true) {
try {
String xBoardCommand = xBoardInput.readLine();
logger.info(xBoardCommand);
//System.err.println(xBoardCommand);
if (xBoardCommand.startsWith("quit")) {
break;
//if (xBoardCommand.startsWith("quit")) {
// logger.info(">quit;");
// break;
//}
if (xBoardCommand.startsWith("otim")) {
logger.info(">Error");
System.out.println("Error (unknown command): time");
}
if (xBoardCommand.startsWith("e2e4")) {
logger.info(">move b8c6");
System.out.println("move b8c6");
}
if (xBoardCommand.startsWith("d2d4")) {
logger.info(">move d7d5");
System.out.println("move d7d5");
}
if (xBoardCommand.startsWith("d2d3")) {
logger.info(">invalid move d2d3");
System.out.println("Illegal move (Don't like it.): d2d3");
}
} catch (Exception err) {
logger.info(err.toString());
break;
}
}