/** * @brief 更新画像のクリックイベント * * テキスト情報を更新する */ private void pictureBox1_Click(object sender, EventArgs e) { MyTextOperation myTextOperation = new MyTextOperation(); if (First_box.Text == null || First_box.Text == "") { First_box.Text = myTextOperation.Get_First_Text(); } Second_box.Text = myTextOperation.Get_Second_Text(); if (Second_box.Text == "" || Second_box.Text == null) { Second_box.Text = MyString.NOTHING_TXT; } this.ActiveControl = null; }
/** * @brief edaxの再起動 * * edaxを落とし、再起動する (book更新のため) */ private void Restart_edax() { edax_process.StandardInput.WriteLine(MyString.EXIT); Console.WriteLine( "\n\n-----bookの更新中-----\n" + MyInteger.wait_start.ToString() + "秒操作不可です!.....\n"); MyTextOperation MyTextOperation = new MyTextOperation(); MyTextOperation.Delete_Text(); //book更新のために本スレッドを停止させる System.Threading.Thread.Sleep(MyInteger.wait_start * 1000); Console.Clear(); Start_edax(); MyInput(); }
/** * @brief edaxへの標準入力 * * 学習予定リストから棋譜を取得し、その内容に応じて標準入力 */ private void MyInput() { //テキストから棋譜を取得 MyTextOperation MyTextOperation = new MyTextOperation(); String second_txt = MyTextOperation.Get_Second_Text(); Second_box.Text = second_txt; if (second_txt == null || second_txt.Trim().Equals("")) { Second_box.Text = MyString.NOTHING_TXT; } String first_txt = MyTextOperation.Get_First_Text(); First_box.Text = first_txt; if (first_txt == null || first_txt.Equals("")) { //テキストファイルが空行 is_learning = false; MessageBox.Show(MyString.NOTHING_TXT); set_received_ok(); Console.Clear(); return; } if (first_txt.Equals("stop")) { //【stop】 is_learning = false; MessageBox.Show(MyString.STOP); set_received_ok(); Console.Clear(); return; } Boolean isDeviate = first_txt.Substring(0, 1) == ("["); is_learning = true; if (isDeviate) { //【deviate】 //引数2つを取得 (2桁にも対応) int index_mark = first_txt.IndexOf("]"); int index_empty = first_txt.IndexOf(" "); String dev_param1 = first_txt.Substring(1, index_empty - 1); String dev_param2 = first_txt.Substring(index_empty + 1, index_mark - 1); String moves = first_txt.Substring(index_mark + 1).Trim(); if (!is_RecordMoves(moves)) { //不適切な文字列の場合はSTOP MessageBox.Show(MyString.TXT_ERROR); set_received_ok(); Console.Clear(); return; } // >> //ToDo ここらでdevの可否をチェックしたい // << edax_process.StandardInput.WriteLine(MyString.PLAY + moves); edax_process.StandardInput.WriteLine(MyString.BOOK_DEVIATE + dev_param1 + " " + dev_param2); } else if (first_txt.Trim().Equals("fix")) { //【fix】 Console.WriteLine("book fix を開始....."); edax_process.StandardInput.WriteLine(MyString.BOOK_FIX); } else { //【mode 2】 //まずランダム幅指定をチェックする String moves = first_txt.Trim(); String randomness = MyInteger.randomness_init.ToString(); Boolean is_set_random = first_txt.Contains(","); if (is_set_random) { //幅指定あり int conma_index = first_txt.IndexOf(","); randomness = first_txt.Substring(0, conma_index); moves = first_txt.Substring(conma_index + 1).Trim(); } if (!is_RecordMoves(moves)) { //不適切な文字列の場合はSTOP MessageBox.Show(MyString.TXT_ERROR); set_received_ok(); Console.Clear(); return; } edax_process.StandardInput.WriteLine(MyString.BOOK_RANDOMNESS + randomness); edax_process.StandardInput.WriteLine(MyString.PLAY + moves); edax_process.StandardInput.WriteLine(MyString.MODE_2); } }