private void Tetris_Map_Load(object sender, EventArgs e) { /*맵 그리기*/ Map.Width = width; Map.Height = height; graphics = Map.CreateGraphics(); figure = new Figure(Map, width / Interval, height / Interval); Map.BackColor = Color.White; /* 유전 알고리즘 삽입 */ Learning = new Genetic(); /*AI_객체 생성*/ try { Calculator = new CalculationNetwork(Learning.get_Formula(), Learning.Load_Recent_Gene()); } catch (Exception ex) { Calculator = new CalculationNetwork(Learning.get_Formula()); Console.WriteLine(ex.Message); } heuristics = new Heuristics(width / Interval, height / Interval, Calculator); Generator = new Random(); /*테트리스 객체 생성*/ mapping = new Mapping(heuristics, width / Interval, height / Interval); /*UI Initializer*/ trial = false; useUI = false; UI_Clear(); Genetic_UI_Drawer(); }
public void game_Start() { try { Calculator = new CalculationNetwork(Learning.get_Formula(), Learning.Load_Recent_Gene()); } catch (Exception ex) { Console.WriteLine(ex.Message); } heuristics = new Heuristics(width / Interval, height / Interval, Calculator); mapping = new Mapping(heuristics, width / Interval, height / Interval); heuristics.set_Weight(Learning.get_Weight()); Next_Block = Generator.Next(6); Current_Block = Generator.Next(6); BlockColor = mapping.init_Character(Current_Block, 5); }
bool Line_swap = false;//use in busy waiting /* * 캐릭터 좌표는 반드시 0,0이 가장 아래쪽에 오도록 구현할것. * */ public Mapping(Heuristics H_temp, int Width, int Height) { heuristics = H_temp; numWidth = Width; numHeight = Height; Tower_Height = numHeight; Score = 0; form = new Formator(); Color_Form = form.get_Color_Form(); Figure_Form = form.get_Figure_Form(); Matrix = new char[numHeight, numWidth]; for (int i = 0; i < numHeight; i++) { for (int j = 0; j < numWidth; j++) { Matrix[i, j] = empty; } } Rotation = 0;//회전 값 초기화. }