Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Test suite for move generation

Author: Keith Evans

Date: 08:00:42 03/04/04

Go up one level in this thread


On March 04, 2004 at 10:56:11, Keith Evans wrote:

>On March 04, 2004 at 08:59:45, Andrew Wagner wrote:
>
>>Wow! Great idea! Does Crafty output move lists like this?
>
>That code with the "KME" comments is part of crafty. If you patch crafty, and
>experiment a little you should be able to output move lists. (Maybe if you're
>smarter than me you won't have to patch crafty, but I found that format nice.
>Also there might be some other program that you could use as a reference.) I
>don't have a full list of instructions at the top of my head, it's been a little
>while. After you get crafty to do this, then you can modify your program to use
>the same format.
>
>-Keith

Here's an example of how you would use two movelists to debug:

#!/bin/sh
#
######################################################################
# A shell script + Awk script to mark illegal moves that X-ray makes
#
# Inputs: dut.raw = unsorted moves made by X-ray
#         ref.raw = unsorted moves made by Crafty
#
# Outputs: dut.marked = dut.raw with illegal moves marked
#
######################################################################
# Copyright 2003 by Keith Evans
######################################################################
sort dut.raw > dut.sort
sort ref.raw > ref.sort
diff dut.sort ref.sort | grep "<" | sed "s/< //" > diffs.txt
awk '
BEGIN {
        # Read in bad moves
        #
        while (getline <"diffs.txt" > 0) {
                errors[$0] = 1;
        }

        # Read in all moves and mark illegal ones
        while (getline <"dut.raw" > 0) {
                if ($0 in errors)
                        print $0 " illegal"
                else
                        print $0
        }
}' > dut.marked
echo "===== Missing Moves =====" >> dut.marked
diff dut.sort ref.sort | grep ">" | sed "s/> //" >> dut.marked



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.