Commit d7d6b5c9835dc38b16ec647deafd4ffc78bf7601

Authored by Carlos Picanco
1 parent 2c96cce2
Exists in master

reformat report

units/game_experiment.pas
... ... @@ -147,7 +147,6 @@ type
147 147 property NextCycle : integer read GetNextCycle;
148 148 property NextCondition : integer read GetNextCondition;
149 149 property NextGeneration: string read GetPlayerToKick write SetPlayersQueue;
150   - property ChangeGeneration : string read FChangeGeneration write FChangeGeneration; // helper
151 150 property State : TExperimentState read FState write SetState;
152 151 public
153 152 property OnEndTurn : TNotifyEvent read FOnEndTurn write SetOnEndTurn;
... ... @@ -550,15 +549,12 @@ begin
550 549 // column names, line 1
551 550 LNames := 'Experimento'+#9+#9+#9;
552 551 for i:=0 to Condition[c].Turn.Value-1 do // player's response
553   - LNames += 'P'+IntToStr(i+1)+#9+#9;
554   -
555   - for i:=0 to ContingenciesCount[c]-1 do
556   - if not Contingency[c,i].Meta then
557   - begin
558   - LNames += Contingency[c,i].ContingencyName;
559   - for j:=0 to Condition[c].Turn.Value-1 do
560   - LNames += #9;
561   - end;
  552 + begin
  553 + LNames += 'P'+IntToStr(i+1)+#9+#9;
  554 + for j:=0 to ContingenciesCount[c]-1 do
  555 + if not Contingency[c,j].Meta then
  556 + LNames += #9;
  557 + end;
562 558  
563 559 LNames += VAL_INTERLOCKING+'s';
564 560 for i:=0 to ContingenciesCount[c]-1 do
... ... @@ -574,14 +570,14 @@ begin
574 570 LNames += LineEnding;
575 571  
576 572 // column names, line 2
577   - LNames += 'Condição'+#9+'Ciclo (Absoluto)'+#9+'Ciclo (Geração)'+#9;
  573 + LNames += 'Condição'+#9+'Geração'+#9+'Ciclos'+#9;
578 574 for i:=0 to Condition[c].Turn.Value-1 do
579   - LNames += 'Linha'+#9+'Cor'+#9;
580   -
581   - for i:=0 to ContingenciesCount[c]-1 do
582   - if not Contingency[c,i].Meta then
583   - for j:=0 to Condition[c].Turn.Value-1 do
584   - LNames += 'P'+IntToStr(j+1)+#9;
  575 + begin
  576 + LNames += 'Linha'+#9+'Cor'+#9;
  577 + for j:=0 to ContingenciesCount[c]-1 do
  578 + if not Contingency[c,j].Meta then
  579 + LNames += Contingency[c,j].ContingencyName+#9;
  580 + end;
585 581  
586 582 for i:=0 to ContingenciesCount[c]-1 do
587 583 if Contingency[c,i].Meta then
... ... @@ -605,17 +601,17 @@ var
605 601 begin
606 602 c:= CurrentCondition;
607 603  
608   - LRow := LineEnding + IntToStr(c+1)+#9+IntToStr(GetCurrentAbsoluteCycle)+#9+IntToStr(Condition[c].Cycles.Count+1)+#9;
  604 + LRow := LineEnding + IntToStr(c+1)+#9+IntToStr(Condition[c].Cycles.Generation+1)+#9+IntToStr(GetCurrentAbsoluteCycle+1)+#9;
609 605 for i:=0 to Condition[c].Turn.Value-1 do
  606 + begin
610 607 LRow += GetRowString(FPlayers[i].Choice.Row)+#9+GetColorString(FPlayers[i].Choice.Color)+#9;
611   -
612   - for i:=0 to ContingenciesCount[c]-1 do
613   - if not Contingency[c,i].Meta then
614   - for j:=0 to Condition[c].Turn.Value-1 do
615   - if Contingency[c,i].ConsequenceFromPlayerID(FPlayers[j].ID) <> '' then
  608 + for j:=0 to ContingenciesCount[c]-1 do
  609 + if not Contingency[c,j].Meta then
  610 + if Contingency[c,j].ConsequenceFromPlayerID(FPlayers[i].ID) <> '' then
616 611 LRow += '1'+#9
617 612 else
618 613 LRow += '0'+#9;
  614 + end;
619 615  
620 616 for i:=0 to ContingenciesCount[c]-1 do
621 617 if Contingency[c,i].Meta then
... ... @@ -636,7 +632,9 @@ begin
636 632 LRow := '';
637 633 if Condition[c].Prompt.ResponsesCount = Condition[c].Turn.Value then
638 634 for i:=0 to Condition[c].Prompt.ResponsesCount-1 do
639   - LRow += Condition[c].Prompt.Response(i)+#9
  635 + LRow += 'P'+IntToStr(PlayerIndexFromID[Delimited(1,Condition[c].Prompt.Response(i))]+1)+
  636 + '|'+
  637 + Delimited(2,Condition[c].Prompt.Response(i))+#9
640 638 else
641 639 for i:=0 to Condition[c].Turn.Value-1 do
642 640 LRow += 'NA'+#9;
... ... @@ -767,10 +765,10 @@ end;
767 765 procedure TExperiment.Play;
768 766 var i : integer;
769 767 begin
770   - for i := 0 to Condition[CurrentCondition].Turn.Value-1 do
771   - begin
772   - //TRegData.Save Header;
773   - end;
  768 + //for i := 0 to Condition[CurrentCondition].Turn.Value-1 do
  769 + // begin
  770 + // //TRegData.Save Header;
  771 + // end;
774 772 FState:=xsRunning;
775 773 end;
776 774  
... ...
units/string_methods.pas
... ... @@ -19,6 +19,8 @@ uses
19 19 , game_resources
20 20 ;
21 21  
  22 +function Delimited(i:integer;S:string):string;
  23 +
22 24 function GetRowString(ARow : TGameRow) : string;
23 25 function GetRowFromString(S : string):TGameRow;
24 26  
... ... @@ -120,6 +122,11 @@ begin
120 122 if Length(S) > 0 then while S[1] = Sep do Delete(S, 1, 1);
121 123 end;
122 124  
  125 +function Delimited(i: integer; S: string): string;
  126 +begin
  127 + Result := ExtractDelimited(i, S,['|']);
  128 +end;
  129 +
123 130 function GetRowString(ARow: TGameRow): string;
124 131 begin
125 132 case ARow of
... ...