From bf6948024b5d7af56108093b58977c5f37b035b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Tue, 23 Dec 2014 19:35:06 +0100 Subject: [PATCH] Display both calculated and received answer in solubility suite instead of trying to rank the answer as correct or wrong --- .../problem_generator-solubility_suite.adb | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/problem_generators/problem_generator-solubility_suite.adb b/src/problem_generators/problem_generator-solubility_suite.adb index 336fe2f..7363637 100644 --- a/src/problem_generators/problem_generator-solubility_suite.adb +++ b/src/problem_generators/problem_generator-solubility_suite.adb @@ -24,12 +24,14 @@ package body Solubility_Suite is use FH; AF: SS_Float; - Int_Part_Got: Integer; - Int_Part_Calcd: Integer; - Dec_Part_Got: SS_Float; - Dec_Part_Calcd: SS_Float; - Exp_Part_Got: Integer; - Exp_Part_Calcd: Integer; + Int_Part_A_Str: UB_Text; + Dec_Part_A_Str: UB_Text; + Exp_Part_A_Str: UB_Text; + Int_Part_C_Str: UB_Text; + Dec_Part_C_Str: UB_Text; + Exp_Part_C_Str: UB_Text; + VType_Str: UB_Text; + Units_Str: UB_Text; begin -- Check that there is a valid answer in the map if Answer.Find(ANSWER_NUM_KEY) = Answer_Info.No_Element then @@ -44,26 +46,24 @@ package body Solubility_Suite is return Malformed_Answer; end; - Split_Integer_Decimal_Exponent_Nums(AF, Decimals, Int_Part_Got, Dec_Part_Got, Exp_Part_Got); - Split_Integer_Decimal_Exponent_Nums(Problem.Answer_Num, Decimals, Int_Part_Calcd, Dec_Part_Calcd, Exp_Part_Calcd); + Split_Integer_Decimal_Exponent_Strs(AF, DECIMALS, Int_Part_A_Str, Dec_Part_A_Str, Exp_Part_A_Str); + Split_Integer_Decimal_Exponent_Strs(Problem.Answer_Num, DECIMALS, Int_Part_C_Str, Dec_Part_C_Str, Exp_Part_C_Str); - --Ada.Text_IO.Put_Line(SS_Float'Image(AF) & " " & Integer'Image(Int_Part_Got) & " " & SS_Float'Image(Dec_Part_Got) & " " & Integer'Image(Exp_Part_Got)); - --Ada.Text_IO.Put_Line(SS_Float'Image(Problem.Answer_Num) & " " & Integer'Image(Int_Part_Calcd) & " " & SS_Float'Image(Dec_Part_Calcd) & " " & Integer'Image(Exp_Part_Calcd)); + case Problem.Parameters.P_Subtype is + when V_FROM_G_KS => + VType_Str := To_UB_Text("V =  "); + Units_Str := To_UB_Text(" dm3"); + when KS_FROM_G_V => + VType_Str := To_UB_Text("Ks =  "); + Units_Str := To_UB_Text(""); + when C_FROM_KS_DIFFERENT_IONS | C_FROM_KS_SHARED_ION => + VType_Str := To_UB_Text("c =  "); + Units_Str := To_UB_Text(" mol/dm3"); + end case; - if Int_Part_Got /= Int_Part_Calcd or Exp_Part_Got /= Exp_Part_Calcd then - Message := To_UB_Text("Å patná odpověď, správný výsledek je "); - Get_Precise_Answer_String(Message, Problem.Parameters.P_Subtype, Problem.Answer_Num); - return Wrong_Answer; - end if; + Message := To_UB_Text("Odpověď vypočtená programem: ") & VType_Str & Int_Part_C_Str & To_UB_Text(",") & Dec_Part_C_Str & To_UB_Text(" . 10") & To_UB_Text("") & Exp_Part_C_Str & To_UB_Text("") & Units_Str & To_UB_Text(" - VaÅ¡e odpověď: ") & VType_Str & Int_Part_A_Str & To_UB_Text(",") & Dec_Part_A_Str & To_UB_Text(" . 10") & To_UB_Text("") & Exp_Part_A_Str & To_UB_Text("") & Units_Str; - if (Dec_Part_Calcd + PRECISION) > Dec_Part_Got and (Dec_Part_Calcd - PRECISION) < Dec_Part_Got then - Message := To_UB_Text("Správná odpověď"); - return Correct_Answer; - else - Message := To_UB_Text("Å patná odpověď, správný výsledek je "); - Get_Precise_Answer_String(Message, Problem.Parameters.P_Subtype, Problem.Answer_Num); - return Wrong_Answer; - end if; + return Correct_Answer; end Check_Answer; function Get_Assignment(Problem: in out Solubility_Problem; Assignment: in out Assignment_Info.Map; Resource_Prefix: in String) return RetCode is -- 2.43.5