Beispiel #1
0
 public CCMove?PollNextMove()
 {
     if (ColdClearInterface.cc_poll_next_move(bot, out var move))
     {
         return(move);
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
        public void Reset(ushort[] field, bool b2b, uint combo)
        {
            var array = new bool[10 * field.Length];

            for (var i = 0; i < field.Length; i++)
            {
                for (var j = 0; j < 10; j++)
                {
                    array[i * 10 + j] = (field[i] & (1 << j)) != 0;
                }
            }

            ColdClearInterface.cc_reset_async(bot, array, b2b, combo);
        }
Beispiel #3
0
        public void AddNextPiece(PieceKind piece)
        {
            switch (piece)
            {
            case PieceKind.I:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_I);
                break;

            case PieceKind.O:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_O);
                break;

            case PieceKind.T:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_T);
                break;

            case PieceKind.J:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_J);
                break;

            case PieceKind.L:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_L);
                break;

            case PieceKind.S:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_S);
                break;

            case PieceKind.Z:
                ColdClearInterface.cc_add_next_piece_async(bot, CCPiece.CC_Z);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(piece), piece, null);
            }
        }
Beispiel #4
0
 private void ReleaseUnmanagedResources()
 {
     ColdClearInterface.cc_destroy_async(bot);
 }
Beispiel #5
0
 public ColdClearBot()
 {
     ColdClearInterface.cc_default_options(out var options);
     ColdClearInterface.cc_default_weights(out var weights);
     bot = ColdClearInterface.cc_launch_async(options, weights);
 }
Beispiel #6
0
 public void RequestNextMove(uint incoming)
 {
     ColdClearInterface.cc_request_next_move(bot, incoming);
 }