Example #1
0
        public static void ConvertChessNotation(int offset)
        {
            string filepath = Program.folderpath + "\\DataSet.txt";

            byte[] buffer = File.ReadAllBytes(filepath);

            for (int i = 0; i < buffer.Length; i++)
            {
                if (offset > 0)
                {
                    i += (buffer[i + 1] * 256 + buffer[i + 2] - 1) * 10 + 2;
                    offset--;
                }
                else
                {
                    Variables.winningColor  = buffer[i];
                    Variables.stateCount    = (buffer[i + 1] * 256 + buffer[i + 2]);
                    Program.Dimensions[0]   = Variables.stateCount;
                    Variables.InputState    = new float[Variables.stateCount][];
                    Variables.InputState[0] = new float[64];
                    Array.Copy(defaultInput, Variables.InputState[0], 64);
                    byte[] data = new byte[5];

                    for (int j = 0; j < Variables.stateCount - 1; j++)
                    {
                        Array.Copy(buffer, 3 + i + j * 10, data, 0, 5);
                        ChessMove.CheckChessMove(j + 1, data, 1);
                        Array.Copy(buffer, 8 + i + j * 10, data, 0, 5);
                        ChessMove.CheckChessMove(j + 1, data, 0);
                    }

                    i = buffer.Length;
                }
            }
        }