Skip to content

Instantly share code, notes, and snippets.

@zzzz465
Last active March 16, 2020 06:52
Show Gist options
  • Save zzzz465/4a4981827b36bd9d73dd6fd87c667e27 to your computer and use it in GitHub Desktop.
Save zzzz465/4a4981827b36bd9d73dd6fd87c667e27 to your computer and use it in GitHub Desktop.
Test Code
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using ColdClear;
namespace TetrisOverlay
{
class Program
{
static void Main(string[] args)
{
// copy of pre-release options.yaml cofnig file.
var options = new CCOptions() { mode = CCMovementMode.CC_0G, use_hold = true, speculate = true, min_nodes = 0, max_nodes = 999999, threads = 1 };
var weights = new CCWeights() { back_to_back = 52, bumpiness = -24, bumpiness_sq = -7,
height = -39, top_half = -150, top_quarter = -511,
jeopardy = -5, cavity_cells = -158, cavity_cells_sq = -7,
overhang_cells = -48, overhang_cells_sq = 1, covered_cells = -17,
covered_cells_sq = -1, tslot = new int[] { 8, 148, 192, 407 }, well_depth = 57,
max_well_depth = 17, well_column = new int[] { 20, 23, 20,
50, 59, 21,
59, 10, -10,
24 },
b2b_clear = 104, clear1 = -143, clear2 = -100, clear3 = -58, clear4 = 390,
tspin1 = 121, tspin2 = 410, tspin3 = 602, mini_tspin1 = -158,
mini_tspin2 = -93, perfect_clear = 999, combo_garbage = 150, move_time = -3,
wasted_t = -152, use_bag = true };
Console.WriteLine("launching cold clear");
IntPtr cc_Pointer = ColdClearAPI.cc_launch_async(ref options, ref weights);
Console.WriteLine("launching complete");
var isDead = ColdClearAPI.cc_is_dead_async(ref cc_Pointer);
//already died after launching, (no matter how much the time spents, immediately or delayed)
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_I);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_J);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_L);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_O);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_S);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_T);
ColdClearAPI.cc_add_next_piece_async(ref cc_Pointer, CCPiece.CC_Z);
ColdClearAPI.cc_request_next_move(ref cc_Pointer, 0);
CCMove move = new CCMove();
var result = ColdClearAPI.cc_poll_next_move(ref cc_Pointer, ref move);
ColdClearAPI.cc_destroy_async(ref cc_Pointer);
Console.WriteLine("End test");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment