private static void TrainNetwork(LearningData learningData, String networkPath) { ActivationNetwork network = new ActivationNetwork( UseBipolar ? (IActivationFunction) new BipolarSigmoidFunction(1) : (IActivationFunction) new SigmoidFunction(), 784, 784, 10); network.Randomize(); Int32 epochIndex = 0; new NguyenWidrow(network).Randomize(); //// create teacher //PerceptronLearning teacher = new PerceptronLearning(network);// new BackPropagationLearning(network); //PerceptronLearning teacher = new PerceptronLearning(network);// new BackPropagationLearning(network); ParallelResilientBackpropagationLearning teacher = new ParallelResilientBackpropagationLearning(network); //teacher.LearningRate = 0.0125; ////teacher.Momentum = 0.5f; Double error = Double.MaxValue; Double previousError = Double.MaxValue; Stopwatch sw = new Stopwatch(); Int32 counter = 100; // loop while (counter > 0) { sw.Reset(); sw.Start(); // run epoch of learning procedure error = teacher.RunEpoch(learningData.Input, learningData.Output); sw.Stop(); //if (error > previousError) //{ // teacher.LearningRate = teacher.LearningRate * 0.5f; //} Console.WriteLine(String.Format("{0} {1} {2}", epochIndex, error, sw.Elapsed.TotalSeconds)); epochIndex++; previousError = error; counter--; } network.Save(networkPath); //Double[] output = network.Compute(learningData.Input[0]); }
public void Arrange() { _fixture = new Fixture(); var collectionPeriods = new List <CollectionCalendarPeriod>() { new CollectionCalendarPeriod(new CollectionPeriod(1, _fixture.Create <short>()), _fixture.Create <byte>(), _fixture.Create <short>(), _fixture.Create <DateTime>(), _fixture.Create <DateTime>(), true, false), }; var collectionCalendar = new CollectionCalendar(collectionPeriods); _mockCollectionCalendarService = new Mock <ICollectionCalendarService>(); _mockCollectionCalendarService.Setup(m => m.Get()).ReturnsAsync(collectionCalendar); _sutModel = _fixture.Build <ApprenticeshipIncentiveModel>().With(x => x.Status, IncentiveStatus.Active).Create(); _sutModel.PendingPaymentModels = new List <PendingPaymentModel>(); _sutModel.PendingPaymentModels.Add(_fixture.Build <PendingPaymentModel>().With(x => x.DueDate, new DateTime(2021, 1, 1)).With(x => x.ClawedBack, false).With(x => x.PaymentMadeDate, (DateTime?)null).Create()); _sutModel.PendingPaymentModels.Add(_fixture.Build <PendingPaymentModel>().With(x => x.DueDate, new DateTime(2021, 2, 28)).With(x => x.ClawedBack, false).With(x => x.PaymentMadeDate, (DateTime?)null).Create()); _sutModel.PaymentModels = new List <PaymentModel>(); _sutModel.ClawbackPaymentModels = new List <ClawbackPaymentModel>(); _sut = Sut(_sutModel); var learningData = new LearningData(true); learningData.SetIsStopped(new LearningStoppedStatus(true, _sutModel.PendingPaymentModels.Last().DueDate.AddDays(-1))); var submissionData = new SubmissionData(); submissionData.SetSubmissionDate(DateTime.Now); submissionData.SetLearningData(learningData); _learner = Learner.New(_fixture.Create <Guid>(), _sutModel.Id, _fixture.Create <long>(), _fixture.Create <long>(), _fixture.Create <long>()); _learner.SetSubmissionData(submissionData); }
static void Main(String[] args) { try { String command = args[0]; String inputFile = args[1]; String inputLabelsFile = args[2]; String networkPath = args[3]; Record[] records = MergeData(ReadPixels(inputFile), ReadLabels(inputLabelsFile)); switch (command) { case "train": LearningData learningData = PrepareLearningData(records); TrainNetwork(learningData, networkPath); break; case "test": TestNetwork(records, networkPath); break; } } catch (Exception ex) { Console.WriteLine(ex); } }
public void Update(LearningDataDto learningData) { if (learningData == null || learningData.ImageData == null) { throw new ArgumentNullException("learningData"); } var imageDataForDb = new ImageData() { Title = learningData.ImageTitle, Data = Convert.FromBase64String(learningData.ImageData), LearningDataId = learningData.Id }; _dataAccessFactory.CreateImageDataAccess(_configuration).UpdateImageData(imageDataForDb); var learningDataForDb = new LearningData() { LearningDataId = learningData.Id, Name = learningData.Name, Description = learningData.Description, Number = learningData.Number, CategoryId = learningData.CategoryId }; _dataAccessFactory.CreateLearningDataAccess(_configuration).UpdateLearningData(learningDataForDb); }
//把Flow Data轉換成適合分析的Data格式 public static List <(double[], string)> FlowStatisticsToLearningData(DataFlowStatistics[] FlowStatistics) { List <(double[], string)> LearningData = new List <(double[], string)>(); object LearningDataLock = new object(); //列出單位時間有哪些IP string[] FlowSourceAddress = FlowStatistics.Select(c => c.Source_Address) .Distinct().ToArray(); Parallel.For <List <(double[], string)> >(0, FlowSourceAddress.Length, () => { return(new List <(double[], string)>()); }, (Index, State, DataList) => { List <(int, int, int, Int64)> FlowStatisticsModelsList = FlowStatistics.Where(c => c.Source_Address == FlowSourceAddress[Index]) .Select(c => (c.Protocal, c.Port, c.Count, c.ByteTotal)).ToList(); DataList.Add((ToLearningData(FlowStatisticsModelsList), FlowSourceAddress[Index])); return(DataList); }, (DataList) => { lock (LearningDataLock) LearningData.AddRange(DataList); }); return(LearningData); }
public async Task Then_the_learning_stopped_event_is_raised_when_learning_is_stopped_and_the_incentive_is_already_in_a_stopped_state() { //Arrange _incentiveModel.Status = IncentiveStatus.Stopped; var command = new LearnerChangeOfCircumstanceCommand(_incentive.Id); var stoppedStatus = new LearningStoppedStatus(true, DateTime.Now.AddDays(-2)); var learningData = new LearningData(true); learningData.SetIsStopped(stoppedStatus); var submissionData = _fixture.Create <SubmissionData>(); submissionData.SetSubmissionDate(DateTime.Today); submissionData.SetLearningData(learningData); _learner = new LearnerFactory().GetExisting( _fixture.Build <LearnerModel>() .With(x => x.SubmissionData, submissionData) .With(x => x.ApprenticeshipIncentiveId, _incentive.Id) .With(x => x.ApprenticeshipIncentiveId, _incentive.Id) .Create()); _mockLearnerDomainRepository.Setup(m => m.GetOrCreate(_incentive)).ReturnsAsync(_learner); // Act await _sut.Handle(command); // Assert _incentive.FlushEvents().Count(e => e is LearningStopped).Should().Be(0); }
public void GameFinished(ArrayList roundAnswers) { AnswersToCSV(roundAnswers); this.SaveGameData(); currentQuestionSet = null; currentLearningSet = null; InitNewSessionData(); }
public void ShiftOneLearningPhase() { currentLearningSet = null; currentQuestionSet = null; colorSetNum++; MAX_NUM_OF_PHASES--; UnityEngine.Debug.Log("ShiftOneLearningPhase: data cleared to be ready for a new phase."); }
/// <summary> /// ノード情報の表示 /// </summary> /// <param name="uc_Main"></param> public static void Aa_ShowNode2(LearningData learningData, Uc_Main uc_Main) { // 手目済み uc_Main.TxtTemezumi.Text = learningData.Kifu.CurNode.Value.KyokumenConst.Temezumi.ToString(); // 総ノード数 uc_Main.TxtAllNodesCount.Text = learningData.Kifu.CountAllNodes().ToString(); // 合法手の数 uc_Main.TxtGohosyuTe.Text = ((KifuNode)learningData.Kifu.CurNode).Count_ChildNodes.ToString(); }
public bool UpdateLearningData(LearningData learningData) { var updateQuery = $@" UPDATE {TableName} SET {ColumnNames.Name} = @Name, {ColumnNames.Description} = @Description, {ColumnNames.Number} = @Number, {ColumnNames.CategoryId} = @CategoryId, WHERE {ColumnNames.PrimaryKey} = @LearningDataId"; return(DataAccessHelper.ExecuteWithinConnection((connection) => connection.Execute(updateQuery), _configuration) == 1); }
public int AddLearningData(LearningData learningData) { var insertAndSelectIdQuery = $@" INSERT INTO {TableName} ({ColumnNames.Name}, {ColumnNames.Description}, {ColumnNames.Number}, {ColumnNames.CategoryId}) OUTPUT INSERTED.{ColumnNames.PrimaryKey} VALUES (@Name, @Description, @Number, @CategoryId);"; return(DataAccessHelper.ExecuteWithinConnection( (connection) => connection.QuerySingle <int>(insertAndSelectIdQuery, learningData), _configuration )); }
private int AddLearningData(LearningDataDto learningData) { var learningDataForDb = new LearningData() { Name = learningData.Name, Description = learningData.Description, Number = learningData.Number, CategoryId = learningData.CategoryId }; return(_dataAccessFactory.CreateLearningDataAccess(_configuration).AddLearningData(learningDataForDb)); }
private LearningDataDto CreateLearningDataDto(LearningData learningData, ImageData imageData) { return(new LearningDataDto() { Id = learningData.LearningDataId, Name = learningData.Name, Description = learningData.Description, Number = learningData.Number, ImageTitle = imageData.Title, ImageData = Convert.ToBase64String(imageData.Data), CategoryId = learningData.CategoryId }); }
public ActionResult Create(LearningData m) { if (ModelState.IsValid) { if (um.Create(m)) { return(Redirect("/Contents/html/parent_reload.htm")); } } ViewBag.categories = um.GetCategoryList(m.LDC_Id); return(View(m)); }
private static void TrainNetwork(LearningData learningData, String networkPath) { ActivationNetwork network = new ActivationNetwork( UseBipolar ? (IActivationFunction) new BipolarSigmoidFunction(1) : (IActivationFunction) new SigmoidFunction(), 784, //784, 10); network.Randomize(); Int32 epochIndex = 0; //// create teacher PerceptronLearning teacher = new PerceptronLearning(network); // new BackPropagationLearning(network); //PerceptronLearning teacher = new PerceptronLearning(network);// new BackPropagationLearning(network); teacher.LearningRate = 0.1f; ////teacher.Momentum = 0.5f; Double error = Double.MaxValue; Double previousError = Double.MaxValue; Int32 counter = 100; // loop while (counter > 0) { // run epoch of learning procedure error = teacher.RunEpoch(learningData.Input, learningData.Output); if (error > previousError) { teacher.LearningRate = teacher.LearningRate * 0.5f; } Console.WriteLine(String.Format("{0} {1}", epochIndex, error)); epochIndex++; previousError = error; counter--; } network.Save(networkPath); //Double[] output = network.Compute(learningData.Input[0]); }
public Boolean Edit(LearningData model) { try { olsEni.Entry(model).State = EntityState.Modified; olsEni.SaveChanges(); return(true); } catch (Exception ex) { StaticHelper.RecordSystemLog(ex); return(false); } }
public LearningData GetNew() { LearningData model; model = new LearningData() { LD_Title = "", LD_Content = "", LD_Remark = "", LD_AddTime = DateTime.Now, LD_Status = (Byte)Status.Available }; return(model); }
/// <summary> /// MoveAI /// </summary> void MoveAI(LearningData data) { float position = (float)(ballPositionCoeff * data.BallYPosition + ballDirectionCoeff * data.BallDirection + freeCoeff); if (position > 3.0f - 0.75f) { position = position - (position - 3.0f + 0.75f); } else if (position < -3.0f + 0.75f) { position = position + (-3.0f + 0.75f - position); } targetPosition = position; move = true; }
public void Update_ShouldCallUpdateOnDataLayer_WhenProvidingValidUpdateRequest() { // Arrange var updatedDataDto = new LearningDataDto() { Id = 0, Name = "New Name", Description = "New description", Number = 911, ImageData = "QUJD", ImageTitle = "New Title", CategoryId = 42 }; var expectedLearningData = new LearningData() { LearningDataId = updatedDataDto.Id, Name = updatedDataDto.Name, Description = updatedDataDto.Description, Number = updatedDataDto.Number, CategoryId = updatedDataDto.CategoryId }; var expectedImageData = new ImageData() { LearningDataId = updatedDataDto.Id, Title = updatedDataDto.ImageTitle, Data = Convert.FromBase64String(updatedDataDto.ImageData) }; ImageDataAccessMock.Setup(x => x.UpdateImageData(It.IsAny <ImageData>())).Returns(true); LearningDataAccessMock.Setup(x => x.UpdateLearningData(It.IsAny <LearningData>())).Returns(true); // Act Sut.Update(updatedDataDto); // Assert // We need to verify mocks manually since object arguments are being provided LearningDataAccessMock.Verify(mock => mock.UpdateLearningData( It.Is <LearningData>(data => CompareLearningData(data, expectedLearningData)) )); LearningDataAccessMock.VerifyNoOtherCalls(); ImageDataAccessMock.Verify(mock => mock.UpdateImageData( It.Is <ImageData>(data => CompareImageData(data, expectedImageData)) )); ImageDataAccessMock.VerifyNoOtherCalls(); }
private void LoadLearningSet() { if (File.Exists(UPDATED_LEARNING_DATA_PATH)) { File.Delete(UPDATED_LEARNING_DATA_PATH); } RunMyColorsBack(BACK_LEARNING_DATA_GENERATION_COMMAND); if (File.Exists(UPDATED_LEARNING_DATA_PATH)) { string dataAsJson = File.ReadAllText(UPDATED_LEARNING_DATA_PATH); currentLearningSet = JsonUtility.FromJson <LearningData>(dataAsJson); } else { UnityEngine.Debug.LogError("No learning data found."); HandleError("Error Loading the Learning Set."); } }
//將樣本資料轉換成適合學習的資料格式 public static (double[][], double[][]) FlowSampleToLearningData(FlowSampleStatistics[] FlowSamples) { List <(double[], double[])> LearningData = new List <(double[], double[])>(); object LearningDataLock = new object(); DateTime[] SampleTimes = FlowSamples.Select(c => c.StartTime) .Distinct().ToArray(); Parallel.For <List <(double[], double[])> >(0, SampleTimes.Length, () => { return(new List <(double[], double[])>()); }, (Index, State, DataList) => { string[] Addresss = FlowSamples.Where(c => c.StartTime == SampleTimes[Index]) .Select(c => c.Source_Address).Distinct().ToArray(); foreach (var Address in Addresss) { List <(int, int, int, Int64)> FlowStatisticsModelsList = FlowSamples.Where(c => c.StartTime == SampleTimes[Index] && c.Source_Address == Address) .Select(c => (c.Protocal, c.Port, c.Count, c.ByteTotal)).ToList(); DataList.Add((ToLearningData(FlowStatisticsModelsList), Decoder(3, FlowSamples.Where(c => c.StartTime == SampleTimes[Index] && c.Source_Address == Address).Select(c => c.BehaviorNumber).Distinct().First()))); } return(DataList); }, (DataList) => { lock (LearningDataLock) LearningData.AddRange(DataList); }); List <double[]> Input = new List <double[]>(); List <double[]> ANS = new List <double[]>(); foreach (var q in LearningData) { Input.Add(q.Item1); ANS.Add(q.Item2); } return(Input.ToArray(), ANS.ToArray()); }
public Boolean Create(LearningData model) { try { Int32 id; id = GetLDId(); model.LD_Id = id; model.LD_Sort = id; olsEni.LearningDatas.Add(model); olsEni.SaveChanges(); return(true); } catch (Exception ex) { StaticHelper.RecordSystemLog(ex); return(false); } }
public void Run() { // 入力レイヤ var inputLayer = new InputLayer(3); // 隠れレイヤ var layer00 = new FullyConnectedLayer(inputLayer, 20, DLF.ReLU, DLF.UpdateWeight(), DLF.GetRandomWeight); // 隠れレイヤ var layer01 = new FullyConnectedLayer(layer00, 10, DLF.ReLU, DLF.UpdateWeight(), DLF.GetRandomWeight); // 出力レイヤ var layer02 = new SoftmaxLayer(layer01, 3); var batchSize = 8; var epoch = 1000; var learningRate = 0.01; Func <IEnumerable <Tuple <double, double> >, double> errorFunction = DLF.ErrorFunctionCrossEntropy; var machine = new Machine(learningRate, epoch, batchSize, new Validator(3) , x => errorFunction(x) * (1.0 / batchSize) , inputLayer , layer00 , layer01 , layer02); // 学習データを生成 var testData = DLF.Shuffle( from x in Enumerable.Range(1, 8) from y in Enumerable.Range(1, 8) from z in Enumerable.Range(1, 8) let v = x + (y * 2) + z let expect = v < 15 ? new[] { 1.0, 0.0, 0.0 } : v < 20 ? new[] { 0.0, 1.0, 0.0 } : new[] { 0.0, 0.0, 1.0 } select LearningData.New(expect.ToString(), new double[] { x, y, z }, expect)) .ToArray(); var validData = testData.Skip(testData.Length / 2).ToArray(); testData = testData.Take(testData.Length / 2).ToArray(); machine.Learn(testData.ToArray(), validData.ToArray()); }
public void Add_ShouldStoreLearningDataInDataLayer_WhenValidObjectIsProvided() { // Arrange var expectedPrimaryKey = 5; var expectedImageData = new ImageData() { LearningDataId = expectedPrimaryKey, Data = LearningDataRepoTestData.DummyImageData1.Data, Title = LearningDataRepoTestData.DummyImageData1.Title }; var expectedLearningData = new LearningData() { LearningDataId = expectedPrimaryKey, Name = LearningDataRepoTestData.DummyLearningData1.Name, Description = LearningDataRepoTestData.DummyLearningData1.Description, Number = LearningDataRepoTestData.DummyLearningData1.Number, CategoryId = LearningDataRepoTestData.DummyLearningData1.CategoryId }; ImageDataAccessMock.Setup(x => x.AddImageData(It.IsAny <ImageData>())).Returns(true); LearningDataAccessMock.Setup(x => x.AddLearningData(It.IsAny <LearningData>())).Returns(expectedPrimaryKey); // Act var actualPrimaryKey = Sut.Add(LearningDataRepoTestData.DummyLearningDto1); // Assert Assert.Equal(expectedPrimaryKey, actualPrimaryKey); // We need to verify mocks manually since object arguments are being provided LearningDataAccessMock.Verify(mock => mock.AddLearningData( It.Is <LearningData>(data => CompareLearningData(data, expectedLearningData)) )); LearningDataAccessMock.VerifyNoOtherCalls(); ImageDataAccessMock.Verify(mock => mock.AddImageData( It.Is <ImageData>(data => CompareImageData(data, expectedImageData)) )); ImageDataAccessMock.VerifyNoOtherCalls(); }
/// <summary> /// Gather the points /// </summary> /// <param name="gatheredData">The learning data object.</param> /// <returns></returns> IEnumerator GatherPoints(LearningData gatheredData) { CustomVector3 firstPosition = new CustomVector3(this.transform.position.x, this.transform.position.y, this.transform.position.z); gatheredData.BallYPosition = firstPosition.Y; yield return(new WaitForSeconds(Time.deltaTime * 7)); CustomVector3 secondPosition = new CustomVector3(this.transform.position.x, this.transform.position.y, this.transform.position.z); gatheredData.BallDirection = (secondPosition.Y - firstPosition.Y) / (secondPosition.X - firstPosition.X); LineRenderer lineRenderer = GetComponent <LineRenderer>(); lineRenderer.SetPosition(0, new Vector3(firstPosition.X, firstPosition.Y, firstPosition.Z)); lineRenderer.SetPosition(1, new Vector3(secondPosition.X, secondPosition.Y, secondPosition.Z)); // move only when the ball is going to the right if (!gateringData && secondPosition.X > 0) { // send message to move the paddle theAIPlayer.SendMessage("MoveAI", gatheredData); } }
protected static bool CompareLearningData(LearningData data, LearningData reference) { return(data.Name == reference.Name && data.Description == reference.Description && data.Number == reference.Number && data.CategoryId == reference.CategoryId); }
/// <summary> /// Set the points of the ball /// </summary> void SetBallPoints() { gatheredData = new LearningData(); StartCoroutine(GatherPoints(gatheredData)); }
public ResponseJson Sort(Int32 originId, Byte sortFlag) { ResponseJson resJson; resJson = new ResponseJson(); try { String name; Double originSort, destSort; LearningData originModel, destModel, adjustModel; LearningData[] modelAry; List <LearningData> us; name = "资料"; modelAry = new LearningData[2]; originModel = olsEni.LearningDatas.Single(m => m.LD_Id == originId); originSort = originModel.LD_Sort; // 置顶 if (1 == sortFlag) { destSort = olsEni.LearningDatas.Min(m => m.LD_Sort); destModel = olsEni.LearningDatas.Single(m => m.LD_Sort == destSort); if (destSort == originSort) { resJson.status = ResponseStatus.Error; resJson.message = "该" + name + "已置顶。"; return(resJson); } originSort = destSort - 1; originModel.LD_Sort = originSort; } else if (2 == sortFlag) { us = olsEni.LearningDatas .Where(m => m.LD_Sort < originSort) .OrderByDescending(m => m.LD_Sort).Take(2).ToList(); if (us.Count == 0) { resJson.status = ResponseStatus.Error; resJson.message = "该" + name + "已处于顶部。"; return(resJson); } else if (us.Count == 1) { destModel = us[0]; originSort = destModel.LD_Sort; destSort = originModel.LD_Sort; originModel.LD_Sort = originSort; destModel.LD_Sort = destSort; } else { destModel = us[1]; destSort = destModel.LD_Sort; originSort = Math.Round(destSort + 0.00001, 5, MidpointRounding.AwayFromZero); originModel.LD_Sort = originSort; } } else// if (3 == sortFlag) { us = olsEni.LearningDatas .Where(m => m.LD_Sort > originSort) .OrderBy(m => m.LD_Sort).Take(1).ToList(); if (us.Count == 0) { resJson.status = ResponseStatus.Error; resJson.message = "该" + name + "已处于底部。"; return(resJson); } destModel = us[0]; destSort = destModel.LD_Sort; originSort = Math.Round(destSort + 0.00001, 5, MidpointRounding.AwayFromZero); originModel.LD_Sort = originSort; } adjustModel = olsEni.LearningDatas.SingleOrDefault(m => m.LD_Sort == originSort); if (adjustModel != null) { adjustModel.LD_Sort = Math.Round(originSort + 0.00001, 5, MidpointRounding.AwayFromZero); } if (0 == olsEni.SaveChanges()) { resJson.status = ResponseStatus.Error; resJson.message = ResponseMessage.SaveChangesError; return(resJson); } modelAry[0] = originModel; modelAry[1] = destModel; resJson.addition = modelAry; resJson.status = ResponseStatus.Success; return(resJson); } catch (Exception ex) { resJson.status = ResponseStatus.Error; resJson.message = StaticHelper.GetExceptionMessageAndRecord(ex); return(resJson); } }
/// <summary> /// Add gathered data to the list. /// </summary> /// <param name="gatheredData">The gathered data.</param> void AddData(LearningData gatheredData) { dataList.Add(gatheredData); }
/// <summary> /// [一手指す]ボタン。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void IttesasuByBtnClick( ref bool isRequestShowGohosyu, ref bool isRequestChangeKyokumenPng, LearningData learningData, Uc_Main ucMain) { #if DEBUG Stopwatch sw1 = new Stopwatch(); sw1.Start(); #endif if (ucMain is null) { throw new ArgumentNullException(nameof(ucMain)); } // if (logTag is null) throw new ArgumentNullException(nameof(logTag)); // // リストの先頭の項目を取得したい。 // if (ucMain.LstMove.Items.Count < 1) { goto gt_EndMethod; } // リストボックスの先頭から指し手をSFEN形式で1つ取得。 HonpuMoveListItemImpl item = (HonpuMoveListItemImpl)ucMain.LstMove.Items[0]; string sfen = item.Sfen; // (2020-12-18 fri)この機能むずかしいからいったん廃止☆(^~^) // logTag.OnAppendLog?.Invoke($"sfen={sfen}\n"); // // 現局面の合法手は、既に読んであるとします。(棋譜ツリーのNextNodesが既に設定されていること) // // // 合法手の一覧は既に作成されているものとします。 // 次の手に進みます。 // IMove nextMove; { if (learningData.Kifu.CurNode.HasChildNode(sfen)) { Node <IMove, KyokumenWrapper> nextNode = learningData.Kifu.CurNode.GetChildNode(sfen); nextMove = nextNode.Key;//次の棋譜ノードのキーが、指し手(きふわらべ式)になっています。 } else { nextMove = null; throw new Exception($@"指し手[{sfen}]はありませんでした。 {learningData.DumpToAllGohosyu(learningData.Kifu.CurNode.Value.KyokumenConst)}"); } } //---------------------------------------- // 一手指したい。 //---------------------------------------- //↓↓一手指し IttesasuResult ittesasuResult; Util_IttesasuRoutine.Before1( new IttesasuArgImpl( learningData.Kifu.CurNode.Value, ((KifuNode)learningData.Kifu.CurNode).Value.KyokumenConst.KaisiPside, nextMove, // FIXME: これがヌルのことがあるのだろうか? learningData.Kifu.CurNode.Value.KyokumenConst.Temezumi + 1 //1手進める ), out ittesasuResult, //this.Kifu,//診断用 "Util_LearningView#Ittesasu_ByBtnClick" ); Debug.Assert(ittesasuResult.Get_SyuryoNode_OrNull != null, "ittesasuResult.Get_SyuryoNode_OrNull がヌル☆?!"); Util_IttesasuRoutine.Before2( ref ittesasuResult ); // //次ノートを追加します。次ノードを、これからのカレントとします。 // //this.Kifu.AssertChildPside(this.Kifu.CurNode.Value.ToKyokumenConst.KaisiPside, ittesasuResult.Get_SyuryoNode_OrNull.Value.ToKyokumenConst.KaisiPside); Util_IttesasuRoutine.After3_ChangeCurrent( learningData.Kifu, ConvMoveStrSfen.ToMoveStrSfen(ittesasuResult.Get_SyuryoNode_OrNull.Key), ittesasuResult.Get_SyuryoNode_OrNull ); // これで、棋譜ツリーに、構造変更があったはず。 //↑↑一手指し //---------------------------------------- // カレント・ノードより古い、以前読んだ手を削除したい。 //---------------------------------------- Logger.Trace($"カレント・ノード={ConvMoveStrSfen.ToMoveStrSfen(learningData.Kifu.CurNode.Key)}"); int result_removedCount = UtilKifuTree282.IzennoHenkaCutter(learningData.Kifu); Logger.Trace($"削除した要素数={result_removedCount}"); ////---------------------------------------- //// 合法手一覧を作成したい。 ////---------------------------------------- learningData.Aa_Yomi(nextMove); // ノード情報の表示 Util_LearningView.Aa_ShowNode2(ucMain.LearningData, ucMain); // 合法手表示の更新を要求します。 isRequestShowGohosyu = true; // 局面PNG画像を更新を要求。 isRequestChangeKyokumenPng = true; // // リストの頭1個を除外します。 // ucMain.LstMove.Items.RemoveAt(0); #if DEBUG sw1.Stop(); Logger.Trace($"一手指すボタン合計 = {sw1.Elapsed}"); Logger.Trace("────────────────────────────────────────"); #endif gt_EndMethod: ; //---------------------------------------- // ボタン表示の回復 //---------------------------------------- if (0 < ucMain.LstMove.Items.Count) { ucMain.BtnUpdateKyokumenHyoka.Enabled = true;//[局面評価更新]ボタン連打防止解除。 } }