From 5c2ded6ecd68b79a5e5a2e6fa4a0d378babc0146 Mon Sep 17 00:00:00 2001 From: cpicanco Date: Tue, 27 Dec 2016 09:31:36 -0300 Subject: [PATCH] experiment runner - load and save configuration files --- units/game_actors.pas | 27 ++++++++++++++++++--------- units/game_actors_point.pas | 3 ++- units/game_experiment.pas | 17 ++++++++--------- units/game_file_methods.pas | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------ 4 files changed, 162 insertions(+), 103 deletions(-) diff --git a/units/game_actors.pas b/units/game_actors.pas index 1f7164c..b593d82 100644 --- a/units/game_actors.pas +++ b/units/game_actors.pas @@ -96,18 +96,19 @@ type FAppendiceLossSingular, FAppendiceEarnPlural, FAppendiceEarnSingular, - FNicname: string; + FPrepend: string; FStyle : TConsequenceStyle; FP : TGamePoint; FTimer : TTimer; FMessage : TPopupNotifier; + function GetCsqString: string; function GetShouldPublishMessage: Boolean; protected FConsequenceByPlayerID : TStringList; procedure StopTimer(Sender:TObject;var ACloseAction:TCloseAction); procedure SelfDestroy(Sender:TOBject);virtual; public - constructor Create(AOwner:TComponent; ACsqString, ANicname, + constructor Create(AOwner:TComponent; ACsqString, APrepend, APrependLoss,AAppendiceLossSingular,AAppendiceLossPlural, APrependEarn,AAppendiceEarnSingular,AAppendiceEarnPlural,AAppendiceZero:string);overload; constructor Create(AOwner:TComponent; AP:integer; AStyle: TConsequenceStyle; AMessage:array of string);overload; @@ -120,7 +121,7 @@ type procedure PresentPoints(A, B, I, G : TLabel); procedure PresentPoints(APlayerBox: TPlayerBox; G: TLabel); overload; property ShouldPublishMessage : Boolean read GetShouldPublishMessage; - property PlayerNicname : string read FNicname write FNicname; + property Prepend : string read FPrepend; property AppendiceLossSingular : string read FAppendiceLossSingular; property AppendiceLossPlural : string read FAppendiceLossPlural; property AppendiceEarnSingular : string read FAppendiceEarnSingular; @@ -128,6 +129,7 @@ type property AppendiceZero : string read FAppendiceZero; property PrependLoss : string read FPrependLoss; property PrependEarn : string read FPrependEarn; + property CsqString : string read GetCsqString; property Style : TConsequenceStyle read FStyle; property ConsequenseByPlayerID : TStringList read FConsequenceByPlayerID; end; @@ -184,6 +186,7 @@ type procedure Clean;override; property Question: string read FPromptMessage; property PromptResult:string read FResult; + property PromptStyle : TPromptStyle read FPromptStyle; end; @@ -582,7 +585,7 @@ end; { TConsequence } -constructor TConsequence.Create(AOwner: TComponent; ACsqString, ANicname, +constructor TConsequence.Create(AOwner: TComponent; ACsqString, APrepend, APrependLoss, AAppendiceLossSingular, AAppendiceLossPlural, APrependEarn, AAppendiceEarnSingular, AAppendiceEarnPlural, AAppendiceZero: string); var @@ -591,7 +594,7 @@ begin inherited Create(AOwner); // custom message - FNicname:=ANicname; + FPrepend:=APrepend; FPrependLoss:=APrependLoss; FAppendiceLossSingular:=AAppendiceLossSingular; FAppendiceLossPlural:=AAppendiceLossPlural; @@ -619,7 +622,7 @@ begin inherited Create(AOwner); FP := TGamePoint.Create(AOwner,AP); FStyle:=AStyle; - FNicname:=AMessage[0]; + FPrepend:=AMessage[0]; FPrependLoss:=AMessage[1]; FAppendiceLossSingular:=AMessage[2]; FAppendiceLossPlural:=AMessage[3]; @@ -637,7 +640,7 @@ begin inherited Create(AOwner); FP := TGamePoint.Create(AOwner,ExtractDelimited(1,AConsequenceString,['|'])); FStyle:=GetConsequenceStyleFromString(ExtractDelimited(2,AConsequenceString,['|'])); - FNicname:=ExtractDelimited(3,AConsequenceString,['|']); + FPrepend:=ExtractDelimited(3,AConsequenceString,['|']); FPrependLoss:=ExtractDelimited(4,AConsequenceString,['|']); FAppendiceLossSingular:=ExtractDelimited(5,AConsequenceString,['|']); FAppendiceLossPlural:=ExtractDelimited(6,AConsequenceString,['|']); @@ -664,7 +667,7 @@ function TConsequence.AsString(AID: string): string; begin Result := IntToStr(FP.ValueWithVariation) + '|'; Result += GetConsequenceStyleString(FStyle)+'|'; - Result += FNicname +'|'; + Result += FPrepend +'|'; Result += FPrependLoss + '|'; Result += FAppendiceLossSingular + '|'; Result += FAppendiceLossPlural + '|'; @@ -678,7 +681,7 @@ end; function TConsequence.GenerateMessage(ForGroup: Boolean): string; begin - Result := FP.PointMessage(FNicname,FPrependLoss,FAppendiceLossSingular,FAppendiceLossPlural, + Result := FP.PointMessage(FPrepend,FPrependLoss,FAppendiceLossSingular,FAppendiceLossPlural, FPrependEarn,FAppendiceEarnSingular,FAppendiceEarnPlural,FAppendiceZero, ForGroup); FMessage.Text := Result; end; @@ -738,6 +741,12 @@ begin Result := gscBroadcastMessage in FStyle; end; +function TConsequence.GetCsqString: string; +begin + Result := IntToStr(FP.Value)+','+IntToStr(FP.Variation) + '|'; + Result += GetConsequenceStyleString(FStyle); +end; + procedure TConsequence.StopTimer(Sender: TObject; var ACloseAction: TCloseAction ); begin diff --git a/units/game_actors_point.pas b/units/game_actors_point.pas index 239555a..1c4f489 100644 --- a/units/game_actors_point.pas +++ b/units/game_actors_point.pas @@ -35,7 +35,8 @@ type function PointMessage(APrepend, APrependLoss, AAppendiceLossSingular,AAppendiceLossPlural, APrependEarn,AAppendiceEarnSingular,AAppendiceEarnPlural,AAppendiceZero: string; IsGroupPoint: Boolean) : string; property ValueWithVariation : integer read GetValue write FValue; - property Variation : integer read FVariation write FVariation; + property Value : integer read FValue; + property Variation : integer read FVariation; property AsString : string read GetResultAsString; property ResultAsInteger : integer read GetResult; end; diff --git a/units/game_experiment.pas b/units/game_experiment.pas index a4ece77..31c3d5f 100644 --- a/units/game_experiment.pas +++ b/units/game_experiment.pas @@ -46,7 +46,7 @@ type FShowChat: Boolean; FMatrixType: TGameMatrixType; private - FAppPath, + FExperimentPath, FLastReportColNames : string; FRegData : TRegData; FRegChat : TRegData; @@ -719,7 +719,7 @@ var c,i: integer; LRow : string; begin - if Assigned(FRegData) then + if Assigned(FRegData) and Assigned(Condition[c].Prompt) then begin c := CurrentCondition; LRow := ''; @@ -750,15 +750,13 @@ constructor TExperiment.Create(AOwner: TComponent); begin inherited Create(AOwner); FTurnsRandom := TStringList.Create; - LoadExperimentFromResource(Self); - CheckNeedForRandomTurns; end; constructor TExperiment.Create(AOwner: TComponent;AppPath:string); var LDataPath : string; begin inherited Create(AOwner); - FAppPath := AppPath; + FExperimentPath := AppPath; FTurnsRandom := TStringList.Create; //LoadExperimentFromResource(Self); //LDataPath := AppPath+VAL_RESEARCHER+'es'+PathDelim+Researcher+PathDelim+ExperimentName+PathDelim; @@ -804,8 +802,8 @@ begin if Result then FFilename := AFilename else Exit; - - LDataPath := FAppPath+VAL_RESEARCHER+'es'+PathDelim+Researcher+PathDelim+ExperimentName+PathDelim; + FExperimentPath := ExtractFilePath(FFilename); + LDataPath := FExperimentPath+ExperimentName+PathDelim; SetTargetInterlockingEvent; SetContingenciesEvents; @@ -816,7 +814,7 @@ begin FReportReader.UseRange:=True; FReportReader.SetXLastRows(Condition[CurrentCondition].EndCriterium.LastCycles); - FRegData := TRegData.Create(Self, LDataPath+'000.dat'); + FRegData := TRegData.Create(Self, LDataPath+'000.data'); FRegChat := TRegData.Create(Self, LDataPath+'000.chat'); WriteReportHeader; end; @@ -943,7 +941,8 @@ begin for i := 0 to ContingenciesCount[c]-1 do Contingency[c,i].Clean; - Condition[c].Prompt.Clean; + if Assigned(Condition[c].Prompt) then + Condition[c].Prompt.Clean; FRegData.CloseAndOpen; end; diff --git a/units/game_file_methods.pas b/units/game_file_methods.pas index a13300a..9025198 100644 --- a/units/game_file_methods.pas +++ b/units/game_file_methods.pas @@ -20,7 +20,7 @@ uses function LoadExperimentFromResource(var AExperiment: TExperiment):Boolean; - function LoadExperimentFromFile(var AExperiment: TExperiment; AFilename : string):Boolean; + function LoadExperimentFromFile(AExperiment: TExperiment; AFilename : string):Boolean; procedure SaveExperimentToFile(AExperiment: TExperiment; AFilename : string); resourcestring @@ -145,7 +145,7 @@ begin end; end; -function LoadExperimentFromFile(var AExperiment: TExperiment; AFilename: string):Boolean; +function LoadExperimentFromFile(AExperiment: TExperiment; AFilename: string):Boolean; var LIniFile : TIniFile; i: Integer; @@ -181,67 +181,76 @@ var end; end; - procedure ReadContingencies(ACondition:integer;IsMeta : Boolean); + function ReadContingenciesCount(ACondition: integer;LC_KEY:String):integer; var - i : integer; - LS,LCK : string; - LConsequence : TConsequence; - LCriteria:TCriteria; - - procedure SetLCK(i:integer); - begin - if IsMeta then - LCK := KEY_METACONTINGENCY+IntToStr(i+1) - else - LCK := KEY_CONTINGENCY+IntToStr(i+1); - end; + LCK, LS: String; begin + Result := 0; LS := SEC_CONDITION+IntToStr(ACondition+1); - i := AExperiment.AppendContingency(ACondition); - SetLCK(i); + LCK := LC_KEY+IntToStr(Result+1); with LIniFile do - while ValueExists(LS, LCK+KEY_CONSEQUE) and ValueExists(LS, LCK+KEY_CRITERIA)do + while ValueExists(LS, LCK+KEY_CONT_NAME) and ValueExists(LS, LCK+KEY_CONSEQUE) and ValueExists(LS, LCK+KEY_CRITERIA)do begin - AExperiment.Condition[ACondition].Contingencies[i].ContingencyName := ReadString(LS, LCK+KEY_CONT_NAME, ''); - ReadString(LS, LCK+KEY_CONSEQUE, ''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_EARN,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,''); - ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_ZERO, ''); - - - LConsequence := TConsequence.Create(AExperiment, - ReadString(LS,LCK+KEY_CONSEQUE,DEF_CONSEQUENCE)); - LCriteria := GetCriteriaFromString(ReadString(LS, LCK+KEY_CRITERIA, '')); - AExperiment.Condition[ACondition].Contingencies[i] := TContingency.Create(AExperiment,LConsequence,LCriteria,IsMeta); - i := AExperiment.AppendContingency(ACondition); - SetLCK(i); + Inc(Result); + LCK := LC_KEY+IntToStr(Result+1); end; end; + function ReadContingency(AConditionIndex:integer; LCK:string) : TContingency; + var + LS : string; + LConsequence : TConsequence; + LCriteria:TCriteria; + + begin + LS := SEC_CONDITION+IntToStr(AConditionIndex+1); + with LIniFile do + begin + LConsequence := TConsequence.Create(AExperiment, + ReadString(LS, LCK+KEY_CONSEQUE, ''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_PREPEND_EARN,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,''), + ReadString(LS, LCK+KEY_CONSEQUE_MESSAGE_APPEND_ZERO, '') + ); + + LCriteria := GetCriteriaFromString(ReadString(LS, LCK+KEY_CRITERIA, '')); + end; + Result := TContingency.Create(AExperiment,LConsequence,LCriteria,Pos(KEY_METACONTINGENCY,LCK)>0); + end; + procedure ReadConditions; var - s1, LS : string; - i : integer; + s1, LS , LPromptStyle, LPromptMessa: string; + i,j , LContingenciesCount, LMetaContingenCount: integer; C :TCondition; begin - //i := 0; - i := AExperiment.AppendCondition; + i := 0; LS := SEC_CONDITION+IntToStr(i+1); with LIniFile do while SectionExists(LS) do begin - //if i = 0 then - // i := AExperiment.AppendCondition; with C do begin ConditionName := ReadString(LS,KEY_COND_NAME,LS); Points.Count := GetPointsFromString(ReadString(LS, KEY_POINTS_COUNT,DEF_POINTS)); - Points.OnStart := GetPointsFromString(ReadString(LS, KEY_POINTS_ONSTART,DEF_POINTS)); + + if AExperiment.ABPoints then + begin + Points.OnStart.A := ReadInteger(LS, KEY_POINTS_ONSTART_A,0); + Points.OnStart.B := ReadInteger(LS, KEY_POINTS_ONSTART_B,0); + Points.OnStart.G := ReadInteger(LS, KEY_POINTS_ONSTART_G,0); + end + else + begin + Points.OnStart.A := ReadInteger(LS, KEY_POINTS_ONSTART_I,0); + Points.OnStart.G := ReadInteger(LS, KEY_POINTS_ONSTART_G,0); + end; + Turn.Count:= ReadInteger(LS, KEY_TURN_COUNT,0); Turn.Value:= ReadInteger(LS, KEY_TURN_VALUE,2); Turn.Random:= ReadBool(LS, KEY_TURN_RANDOM,False); @@ -254,19 +263,36 @@ var EndCriterium.InterlockingPorcentage:= GetEndCriteriaPorcentageFromString(s1); EndCriterium.LastCycles:= GetEndCriteriaLastCyclesFromString(s1); - ReadContingencies(i,True); - ReadContingencies(i,False); + LContingenciesCount := ReadContingenciesCount(i,KEY_CONTINGENCY); + LMetaContingenCount := ReadContingenciesCount(i,KEY_METACONTINGENCY); + + if LContingenciesCount > 0 then + for j := 0 to LContingenciesCount-1 do + begin + SetLength(Contingencies,Length(Contingencies)+1); + Contingencies[Length(Contingencies)-1] := ReadContingency(i,KEY_CONTINGENCY+IntToStr(j+1)); + end; + + if LMetaContingenCount > 0 then; + for j := 0 to LMetaContingenCount-1 do + begin + SetLength(Contingencies,Length(Contingencies)+1); + Contingencies[Length(Contingencies)-1] := ReadContingency(i,KEY_METACONTINGENCY+IntToStr(j+1)); + end; - Prompt := TPrompt.Create( - AExperiment - , GetPromptStyleFromString(ReadString(LS,KEY_PROMPT_STYLE,'')) - , Contingencies - , ReadString(LS,KEY_PROMPT_MESSAGE,'') - ); + LPromptStyle := ReadString(LS,KEY_PROMPT_STYLE,''); + LPromptMessa := ReadString(LS,KEY_PROMPT_MESSAGE,''); + if (LPromptMessa <> '') and (LPromptStyle <> '') then + Prompt := TPrompt.Create( + AExperiment + , GetPromptStyleFromString(LPromptStyle) + , Contingencies + , LPromptMessa + ); end; - AExperiment.Condition[i]:= C; - i := AExperiment.AppendCondition; + AExperiment.Condition[AExperiment.AppendCondition]:= C; + Inc(i); LS := SEC_CONDITION+IntToStr(i+1); end; end; @@ -290,11 +316,10 @@ var Choice := GetChoiceFromString(ReadString(LS,KEY_PLAYER_CHOICE_LAST,'0,NONE,')); ID := ReadString(LS,KEY_PLAYER_ID,'ID'); Nicname := ReadString(LS,KEY_PLAYER_NICNAME,GenResourceName(i)); - + Points := GetPPointsFromString(ReadString(LS,KEY_PLAYER_POINTS,'0,0,')); // currently not in use //Login := ReadString(LS,KEY_PLAYER_LOGIN,'jogador'+IntToStr(i+1)); //Password := ReadString(LS,KEY_PLAYER_PASSWORD,'1234'); - //Points := GetPPointsFromString(ReadString(LS,KEY_PLAYER_POINTS,'0,0,')); //Status := GetStatusFromString(ReadString(LS,KEY_PLAYER_STATUS,'esperando')); //Data.Values[KEY_PLAYER_TEMP] := ReadString(LS,KEY_PLAYER_TEMP,''); end; @@ -312,7 +337,6 @@ begin with LIniFile do if SectionExists(SEC_EXPERIMENT) then begin - AExperiment := TExperiment.Create(AExperiment.Owner); ReadExperiment; ReadConditions; ReadPlayers; @@ -325,21 +349,21 @@ begin else begin ShowMessage(ERROR_NO_CONTINGENCIES+SEC_CONDITION+IntToStr(i+1)); + LIniFile.Free; Exit; end else begin ShowMessage(ERROR_NO_CONDITIONS); + LIniFile.Free; Exit; end; - Result := True; + AExperiment.CurrentCondition:=0; end else - begin - ShowMessage(ERROR_SECTION_NOT_FOUND+SEC_EXPERIMENT); - Exit; - end; + ShowMessage(ERROR_SECTION_NOT_FOUND+SEC_EXPERIMENT); + LIniFile.Free; end else @@ -348,7 +372,7 @@ end; procedure SaveExperimentToFile(AExperiment: TExperiment; AFilename: string); var - i,j : Integer; + i,j , MI, CI: Integer; LWriter : TRegData; LIniFile : TIniFile; LC, @@ -362,34 +386,59 @@ begin LIniFile.WriteString(SEC_EXPERIMENT,KEY_RESEARCHER,AExperiment.Researcher); with LIniFile do - for i := 0 to AExperiment.ConditionsCount do + for i := 0 to AExperiment.ConditionsCount-1 do begin LC := SEC_CONDITION+IntToStr(i+1); with AExperiment.Condition[i] do begin WriteString(LC,KEY_ENDCRITERIA,GetEndCriteriaString(EndCriterium)); WriteString(LC, KEY_POINTS_COUNT,GetPointsString(Points.Count)); - WriteString(LC, KEY_POINTS_ONSTART,GetPointsString(Points.OnStart)); + if AExperiment.ABPoints then + begin + WriteInteger(LC, KEY_POINTS_ONSTART_A,Points.OnStart.A); + WriteInteger(LC, KEY_POINTS_ONSTART_B,Points.OnStart.B); + WriteInteger(LC, KEY_POINTS_ONSTART_G,Points.OnStart.G); + end + else + begin + WriteInteger(LC, KEY_POINTS_ONSTART_I,Points.OnStart.A); + WriteInteger(LC, KEY_POINTS_ONSTART_G,Points.OnStart.G); + end; WriteInteger(LC, KEY_TURN_COUNT,Turn.Count); WriteInteger(LC, KEY_TURN_VALUE,Turn.Value); WriteBool(LC, KEY_TURN_RANDOM,Turn.Random); WriteInteger(LC, KEY_CYCLES_COUNT,Cycles.Count); WriteInteger(LC, KEY_CYCLES_VALUE,Cycles.Value); WriteInteger(LC, KEY_CYCLES_GEN,Cycles.Generation); - //WriteBool(LC, KEY_PROMPT_VALUE,Prompt.Value); - //WriteString(LC, KEY_PROMPT_MESSAGE, Prompt.PromptMessage); - //WriteString(LC, KEY_PROMPT_STYLE, GetPromptStyleString(Prompt.PromptStyle)); + WriteString(LC, KEY_PROMPT_MESSAGE, Prompt.Question); + WriteString(LC, KEY_PROMPT_STYLE, GetPromptStyleString(Prompt.PromptStyle)); + MI := 0; + CI := 0; for j := 0 to High(Contingencies) do begin if Contingencies[j].Meta then - LCK := KEY_METACONTINGENCY+IntToStr(j+1) + begin + LCK := KEY_METACONTINGENCY+IntToStr(MI+1); + Inc(MI); + end else - LCK := KEY_CONTINGENCY+IntToStr(j+1); + begin + LCK := KEY_CONTINGENCY+IntToStr(CI+1); + Inc(CI); + end; with Contingencies[j] do begin - WriteString(LC,LCK+KEY_CONSEQUE,Consequence.AsString('')); + WriteString(LC,LCK+KEY_CONSEQUE,Consequence.CsqString); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_PREPEND,Consequence.Prepend); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_PREPEND_LOSS,Consequence.PrependLoss); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_S,Consequence.AppendiceLossSingular); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_APPEND_LOSS_P,Consequence.AppendiceLossPlural); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_PREPEND_EARN,Consequence.PrependEarn); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_S,Consequence.AppendiceEarnSingular); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_APPEND_EARN_P,Consequence.AppendiceEarnPlural); + WriteString(LC,LCK+KEY_CONSEQUE_MESSAGE_APPEND_ZERO, Consequence.AppendiceZero); WriteString(LC,LCK+KEY_CRITERIA,CriteriaString); end; end; @@ -397,20 +446,21 @@ begin end; with LIniFile do - for i:=0 to AExperiment.PlayersCount do - with AExperiment.Player[i] do - begin - LC := SEC_PLAYER+IntToStr(i+1); - WriteInteger(LC,KEY_PLAYER_TURN,AExperiment.Player[i].Turn); - WriteString(LC,KEY_PLAYER_CHOICE_LAST,GetChoiceString(AExperiment.Player[i].Choice)); - WriteString(LC,KEY_PLAYER_ID,AExperiment.Player[i].ID); - WriteString(LC,KEY_PLAYER_NICNAME,AExperiment.Player[i].Nicname); - WriteString(LC,KEY_PLAYER_LOGIN,AExperiment.Player[i].Login); - WriteString(LC,KEY_PLAYER_PASSWORD,AExperiment.Player[i].Password); - WriteString(LC,KEY_PLAYER_POINTS,GetPPointsString(AExperiment.Player[i].Points)); - WriteString(LC,KEY_PLAYER_STATUS,GetStatusString(AExperiment.Player[i].Status)); - WriteString(LC,KEY_PLAYER_TEMP,AExperiment.Player[i].Data.Values[KEY_PLAYER_TEMP]); - end; + if AExperiment.PlayersCount > 0 then + for i:=0 to AExperiment.PlayersCount-1 do + with AExperiment.Player[i] do + begin + LC := SEC_PLAYER+IntToStr(i+1); + WriteString(LC,KEY_PLAYER_ID,AExperiment.Player[i].ID); + WriteString(LC,KEY_PLAYER_NICNAME,AExperiment.Player[i].Nicname); + WriteInteger(LC,KEY_PLAYER_TURN,AExperiment.Player[i].Turn); + WriteString(LC,KEY_PLAYER_CHOICE_LAST,GetChoiceString(AExperiment.Player[i].Choice)); + WriteString(LC,KEY_PLAYER_POINTS,GetPPointsString(AExperiment.Player[i].Points)); + //WriteString(LC,KEY_PLAYER_LOGIN,AExperiment.Player[i].Login); + //WriteString(LC,KEY_PLAYER_PASSWORD,AExperiment.Player[i].Password); + //WriteString(LC,KEY_PLAYER_STATUS,GetStatusString(AExperiment.Player[i].Status)); + //WriteString(LC,KEY_PLAYER_TEMP,AExperiment.Player[i].Data.Values[KEY_PLAYER_TEMP]); + end; end; end. -- libgit2 0.21.2