/// <summary> /// Writes results of search to window. /// </summary> public void WriteResults() { int CompareLimit = Convert.ToInt32(CompareTextBox.Text); int CorrectNum = 0; int TotalCorrect = 0; int num = MainData.NumTests(); for (int i = 0; i < num; i++) { MainDataStructure.TestPoint tp = MainData.GetTestPoint(i); int expectedPoint = tp.ExpectedPoint; double minimum = tp.CalculatedMin; int calculatedPoint = tp.CalculatedPoint; int calculatedDirection = tp.CalculatedDirection; int expectedDirection = (testInd == -1) ? tp.ExpectedDirection : testInd; string ptcorrect = (Math.Abs(calculatedPoint - expectedPoint) < CompareLimit) ? "TRUE" : "False"; string dircorrect = (calculatedDirection == expectedDirection) ? "TRUE" : "False"; string bothcorrect = (ptcorrect.Contains("TRUE") && dircorrect.Contains("TRUE")) ? "TRUE" : "False"; rtb.AppendText("Test " + i + ": Expected: " + expectedPoint + " Got: " + calculatedPoint + " with " + minimum + " Expected Dir: " + expectedDirection + " Got: " + calculatedDirection + " Pt? " + ptcorrect + " Dir? " + dircorrect + " Both? " + bothcorrect + Environment.NewLine); if (ptcorrect.Contains("TRUE")) { CorrectNum++; } if (bothcorrect.Contains("TRUE")) { TotalCorrect++; } } double ptpercent = (double)CorrectNum * 100.0 / (double)num; double bothpercent = (double)TotalCorrect * 100.0 / (double)num; rtb.AppendText(Environment.NewLine + "Score: " + CorrectNum + "\\" + num + " " + ptpercent + '%'); rtb.AppendText(Environment.NewLine + "Score: " + TotalCorrect + "\\" + num + " " + bothpercent + '%'); }