diff --git a/experiment_runner/experiment_runner.lpi b/experiment_runner/experiment_runner.lpi
index 16768d0..61e340a 100644
--- a/experiment_runner/experiment_runner.lpi
+++ b/experiment_runner/experiment_runner.lpi
@@ -14,7 +14,11 @@
-
+
+
+
+
+
@@ -30,18 +34,10 @@
-
-
-
-
-
-
-
-
+
-
@@ -86,18 +82,10 @@
-
-
-
-
-
-
-
-
+
-
diff --git a/experiment_runner/form_matrixgame.lfm b/experiment_runner/form_matrixgame.lfm
index 5904c7c..0865616 100644
--- a/experiment_runner/form_matrixgame.lfm
+++ b/experiment_runner/form_matrixgame.lfm
@@ -7,7 +7,7 @@ object FormMatrixGame: TFormMatrixGame
VertScrollBar.Page = 542
AutoScroll = True
Caption = 'Matrix'
- ClientHeight = 609
+ ClientHeight = 616
ClientWidth = 1167
Font.Name = 'Monospace'
OnActivate = FormActivate
@@ -16,24 +16,24 @@ object FormMatrixGame: TFormMatrixGame
AnchorSideLeft.Control = GBIndividualAB
AnchorSideTop.Control = GBIndividualAB
Left = 800
- Height = 131
+ Height = 122
Top = 8
- Width = 162
+ Width = 170
AutoSize = True
Caption = 'Pontuação Individual'
ChildSizing.LeftRightSpacing = 35
ChildSizing.TopBottomSpacing = 45
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
- ClientHeight = 108
- ClientWidth = 158
+ ClientHeight = 105
+ ClientWidth = 166
TabOrder = 7
Visible = False
object LabelIndCount: TLabel
Left = 35
- Height = 18
+ Height = 15
Top = 45
- Width = 88
+ Width = 96
Align = alClient
Alignment = taCenter
AutoSize = False
@@ -71,9 +71,9 @@ object FormMatrixGame: TFormMatrixGame
end
object GBIndividualAB: TGroupBox
Left = 800
- Height = 135
+ Height = 122
Top = 8
- Width = 162
+ Width = 170
AutoSize = True
Caption = 'Pontuação Individual'
ChildSizing.LeftRightSpacing = 10
@@ -83,14 +83,14 @@ object FormMatrixGame: TFormMatrixGame
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
- ClientHeight = 112
- ClientWidth = 158
+ ClientHeight = 105
+ ClientWidth = 166
TabOrder = 1
object LabelIndA: TLabel
Left = 10
- Height = 19
+ Height = 15
Top = 30
- Width = 59
+ Width = 63
Alignment = taCenter
AutoSize = False
Caption = 'A'
@@ -103,10 +103,10 @@ object FormMatrixGame: TFormMatrixGame
Transparent = False
end
object LabelIndB: TLabel
- Left = 89
- Height = 19
+ Left = 93
+ Height = 15
Top = 30
- Width = 59
+ Width = 63
Alignment = taCenter
AutoSize = False
Caption = 'B'
@@ -120,9 +120,9 @@ object FormMatrixGame: TFormMatrixGame
end
object LabelIndACount: TLabel
Left = 10
- Height = 18
- Top = 64
- Width = 59
+ Height = 15
+ Top = 60
+ Width = 63
Alignment = taCenter
AutoSize = False
Caption = '0'
@@ -131,10 +131,10 @@ object FormMatrixGame: TFormMatrixGame
Transparent = False
end
object LabelIndBCount: TLabel
- Left = 89
- Height = 18
- Top = 64
- Width = 59
+ Left = 93
+ Height = 15
+ Top = 60
+ Width = 63
Alignment = taCenter
AutoSize = False
Caption = '0'
@@ -147,10 +147,10 @@ object FormMatrixGame: TFormMatrixGame
AnchorSideLeft.Control = GBIndividualAB
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GBIndividualAB
- Left = 972
- Height = 131
+ Left = 980
+ Height = 122
Top = 8
- Width = 171
+ Width = 170
AutoSize = True
BorderSpacing.Left = 10
Caption = ' Pontuação do Grupo '
@@ -158,14 +158,14 @@ object FormMatrixGame: TFormMatrixGame
ChildSizing.TopBottomSpacing = 45
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
- ClientHeight = 108
- ClientWidth = 167
+ ClientHeight = 105
+ ClientWidth = 166
TabOrder = 2
object LabelGroupCount: TLabel
Left = 35
- Height = 18
+ Height = 15
Top = 45
- Width = 97
+ Width = 96
Align = alClient
Alignment = taCenter
AutoSize = False
@@ -183,9 +183,9 @@ object FormMatrixGame: TFormMatrixGame
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
- Height = 22
- Top = 587
- Width = 1625
+ Height = 17
+ Top = 599
+ Width = 1632
Anchors = [akLeft, akRight, akBottom]
AutoSize = True
Caption = 'Escolhas na última jogada'
@@ -200,21 +200,21 @@ object FormMatrixGame: TFormMatrixGame
AnchorSideLeft.Control = GBGrupo
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GBGrupo
- Left = 1153
+ Left = 1160
Height = 486
Top = 8
Width = 472
BorderSpacing.Left = 10
Caption = 'Pesquisador'
- ClientHeight = 463
+ ClientHeight = 469
ClientWidth = 468
TabOrder = 4
Visible = False
object GBExperiment: TGroupBox
Left = 16
- Height = 221
+ Height = 197
Top = 60
- Width = 220
+ Width = 228
AutoSize = True
Caption = 'Experimento'
ChildSizing.LeftRightSpacing = 10
@@ -224,102 +224,102 @@ object FormMatrixGame: TFormMatrixGame
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
- ClientHeight = 198
- ClientWidth = 216
+ ClientHeight = 180
+ ClientWidth = 224
TabOrder = 0
object LabelExpCond: TLabel
Left = 10
- Height = 18
+ Height = 15
Top = 20
- Width = 154
+ Width = 168
Caption = 'Condição:'
ParentColor = False
end
object LabelExpCountCondition: TLabel
- Left = 184
- Height = 18
+ Left = 198
+ Height = 15
Top = 20
- Width = 22
+ Width = 16
Caption = 'NA'
ParentColor = False
end
object LabelExpGen: TLabel
Left = 10
- Height = 18
- Top = 48
- Width = 154
+ Height = 15
+ Top = 45
+ Width = 168
Caption = 'Geração:'
ParentColor = False
end
object LabelExpCountGeneration: TLabel
- Left = 184
- Height = 18
- Top = 48
- Width = 22
+ Left = 198
+ Height = 15
+ Top = 45
+ Width = 16
Caption = 'NA'
ParentColor = False
end
object LabelExpCycle: TLabel
Left = 10
- Height = 18
- Top = 76
- Width = 154
+ Height = 15
+ Top = 70
+ Width = 168
Caption = 'Ciclo:'
ParentColor = False
end
object LabelExpCountCycle: TLabel
- Left = 184
- Height = 18
- Top = 76
- Width = 22
+ Left = 198
+ Height = 15
+ Top = 70
+ Width = 16
Caption = 'NA'
ParentColor = False
end
object LabelExpTurn: TLabel
Left = 10
- Height = 18
- Top = 104
- Width = 154
+ Height = 15
+ Top = 95
+ Width = 168
Caption = 'Turno:'
ParentColor = False
end
object LabelExpCountTurn: TLabel
- Left = 184
- Height = 18
- Top = 104
- Width = 22
+ Left = 198
+ Height = 15
+ Top = 95
+ Width = 16
Caption = 'NA'
ParentColor = False
end
object LabelExpInterlocks: TLabel
Left = 10
- Height = 18
- Top = 132
- Width = 154
+ Height = 15
+ Top = 120
+ Width = 168
Caption = 'Entrelaçamentos:'
ParentColor = False
end
object LabelExpCountInterlocks: TLabel
- Left = 184
- Height = 18
- Top = 132
- Width = 22
+ Left = 198
+ Height = 15
+ Top = 120
+ Width = 16
Caption = 'NA'
ParentColor = False
end
object LabelExpTInterlocks: TLabel
Left = 10
- Height = 18
- Top = 160
- Width = 154
+ Height = 15
+ Top = 145
+ Width = 168
Caption = 'Entrelaçamentos Alvo:'
ParentColor = False
end
object LabelExpCountTInterlocks: TLabel
- Left = 184
- Height = 18
- Top = 160
- Width = 22
+ Left = 198
+ Height = 15
+ Top = 145
+ Width = 16
Caption = 'NA'
ParentColor = False
end
@@ -372,19 +372,19 @@ object FormMatrixGame: TFormMatrixGame
AnchorSideRight.Side = asrBottom
Left = 800
Height = 354
- Top = 153
- Width = 343
+ Top = 140
+ Width = 350
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 10
ClientHeight = 354
- ClientWidth = 343
+ ClientWidth = 350
TabOrder = 6
object ChatMemoRecv: TMemo
AnchorSideBottom.Control = ChatSplitter
Left = 6
Height = 221
Top = 6
- Width = 331
+ Width = 338
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 5
@@ -405,7 +405,7 @@ object FormMatrixGame: TFormMatrixGame
Left = 0
Height = 5
Top = 232
- Width = 341
+ Width = 348
Align = alNone
Anchors = [akLeft, akRight]
ResizeAnchor = akTop
@@ -416,7 +416,7 @@ object FormMatrixGame: TFormMatrixGame
Left = 6
Height = 106
Top = 242
- Width = 331
+ Width = 338
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 5
@@ -439,7 +439,7 @@ object FormMatrixGame: TFormMatrixGame
top = 360
end
object PopupNotifier: TPopupNotifier
- Color = clTeal
+ Color = clDefault
Icon.Data = {
07544269746D617000000000
}
diff --git a/experiment_runner/form_matrixgame.pas b/experiment_runner/form_matrixgame.pas
index d0c8fbf..ba2fb8b 100644
--- a/experiment_runner/form_matrixgame.pas
+++ b/experiment_runner/form_matrixgame.pas
@@ -80,6 +80,7 @@ type
public
procedure SetID(S : string);
procedure SetGameActor(AValue: TGameActor);
+ procedure SetFullscreen;
property ID : string read FID;
end;
@@ -248,6 +249,17 @@ begin
end;
end;
+procedure TFormMatrixGame.SetFullscreen;
+begin
+ BorderStyle:=bsNone;
+ {$IFDEF WINDOWS}
+ BoundsRect := Monitor.BoundsRect;
+ {$ENDIF}
+ Position:=poDesigned;
+ FormStyle:=fsNormal;
+ WindowState:=wsFullScreen;
+end;
+
procedure TFormMatrixGame.SetID(S: string);
begin
FID := S;
@@ -256,6 +268,7 @@ end;
procedure TFormMatrixGame.FormActivate(Sender: TObject);
begin
+ PopupNotifier.Icon.Assign(Application.Icon);
if not Assigned(FGameControl) then
begin
FormChooseActor := TFormChooseActor.Create(Self);
@@ -319,15 +332,15 @@ begin
ButtonExpStart.Caption := CAPTION_START;
ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
- //FGameControl.Experiment.SaveToFile(SaveDialog.FileName'.canceled');
- //FGameControl.Experiment.Clean;
+ FGameControl.Experiment.SaveToFile(OpenDialog.FileName+'.canceled');
+ FGameControl.SendMessage(K_END);
end;
procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject);
begin
- ButtonExpStart.Enabled := True;
- ButtonExpStart.Caption := CAPTION_RESUME;
- ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
+ //ButtonExpStart.Enabled := True;
+ //ButtonExpStart.Caption := CAPTION_RESUME;
+ //ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
//FGameControl.Pause;
end;
@@ -344,7 +357,7 @@ begin
ButtonExpStart.Caption := CAPTION_RUNNING;
ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
-
+ ChatPanel.Visible := FGameControl.Experiment.ShowChat;
end;
if ButtonExpStart.Caption = CAPTION_RESUME then
@@ -353,7 +366,7 @@ begin
ButtonExpStart.Caption := CAPTION_RUNNING;
ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
- //FGameControl.Resume;
+ FGameControl.Resume;
end;
end;
diff --git a/experiment_runner/lib/x86_64-linux/experiment_runner.compiled b/experiment_runner/lib/x86_64-linux/experiment_runner.compiled
index 3be3317..434dcb5 100644
--- a/experiment_runner/lib/x86_64-linux/experiment_runner.compiled
+++ b/experiment_runner/lib/x86_64-linux/experiment_runner.compiled
@@ -1,5 +1,5 @@
-
+
diff --git a/experiment_runner/units/game_actors.pas b/experiment_runner/units/game_actors.pas
index 8ba77ee..162a517 100644
--- a/experiment_runner/units/game_actors.pas
+++ b/experiment_runner/units/game_actors.pas
@@ -442,7 +442,7 @@ end;
procedure TPrompt.ClearResponses;
begin
- FResponses := nil;
+ SetLength(FResponses,0);
end;
constructor TPrompt.Create(AOwner: TComponent; APStyle: TPromptStyle;
@@ -473,7 +473,7 @@ end;
procedure TPrompt.Clean;
begin
//inherited Clean;
- FResponses := nil;
+ SetLength(FResponses,0);
end;
function TPrompt.AsString: TStringList;
diff --git a/experiment_runner/units/game_control.pas b/experiment_runner/units/game_control.pas
index e92d45d..f18244f 100644
--- a/experiment_runner/units/game_control.pas
+++ b/experiment_runner/units/game_control.pas
@@ -53,7 +53,7 @@ type
private
function AskQuestion(AQuestion:string):UTF8string;
function ShowConsequence(AID,S:string;ForGroup:Boolean;ShowPopUp : Boolean = True) : string;
- procedure ShowPopUp(AText:string;AInterval : integer = 5000);
+ procedure ShowPopUp(AText:string;AInterval : integer = 15000);
procedure DisableConfirmationButton;
procedure CleanMatrix(AEnabled : Boolean);
procedure NextConditionSetup(S : string);
@@ -137,6 +137,7 @@ const
function GetRowColor(ARow: integer; ARowBase:integer): TColor;
var LRow : integer;
begin
+ Result := 0;
if ARowBase = 1 then
LRow := aRow -1
else LRow := aRow;
@@ -179,7 +180,7 @@ end;
function TGameControl.ShouldAskQuestion: Boolean;
begin
- Result := Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) and FExperiment.Condition[FExperiment.CurrentCondition].Contingencies[3].Fired;
+ Result := Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) and FExperiment.TargetIntelockingFired;
end;
procedure TGameControl.EndExperiment(Sender: TObject);
@@ -298,9 +299,8 @@ end;
procedure TGameControl.Stop;
begin
- // Pause
-
// cleaning
+ FExperiment.Clean;
end;
function TGameControl.GetPlayerBox(AID: UTF8string): TPlayerBox;
@@ -317,6 +317,7 @@ end;
function TGameControl.GetActorNicname(AID: UTF8string): UTF8string;
begin
+ Result := '';
case FActor of
gaPlayer: begin
Result := 'UNKNOWN';
@@ -501,8 +502,8 @@ end;
procedure TGameControl.ShowPopUp(AText: string; AInterval: integer);
var PopUpPos : TPoint;
begin
- PopUpPos.X := FormMatrixGame.GBIndividualAB.Left-110;
- PopUpPos.Y := FormMatrixGame.GBIndividualAB.Top+FormMatrixGame.GBIndividual.Height-10;
+ PopUpPos.X := (FormMatrixGame.StringGridMatrix.Width div 2) - (FormMatrixGame.PopupNotifier.vNotifierForm.Width div 2);
+ PopUpPos.Y := (FormMatrixGame.StringGridMatrix.Height div 2) - (FormMatrixGame.PopupNotifier.vNotifierForm.Height div 2);
PopUpPos := FormMatrixGame.ClientToScreen(PopUpPos);
FormMatrixGame.PopupNotifier.Title:='';
FormMatrixGame.PopupNotifier.Text:=AText;
@@ -609,7 +610,7 @@ begin
for P in FExperiment.Players do
begin
PB := GetPlayerBox(P.ID);
- A += StrToInt(PB.LabelPointsCount.Caption) + B;
+ A += StrToInt(PB.LabelPointsCount.Caption);
PB.LabelPointsCount.Caption := IntToStr(A);
end;
end;
@@ -620,6 +621,9 @@ procedure TGameControl.EnablePlayerMatrix(AID:UTF8string; ATurn:integer; AEnable
begin
if FExperiment.PlayerFromID[AID].Turn = ATurn then
CleanMatrix(AEnabled);
+
+ if AEnabled then
+ ShowPopUp('É sua vez! Clique sobre uma linha da matrix e confirme sua escolha.');
end;
constructor TGameControl.Create(AOwner: TComponent;AppPath:string);
@@ -681,6 +685,7 @@ var
M[i] := A[i];
end;
begin
+ SetLength(M,0);
case ARequest of
K_LOGIN :SetM([
FZMQActor.ID
@@ -854,10 +859,7 @@ procedure TGameControl.ReceiveMessage(AMessage: TStringList);
case FActor of
gaPlayer:
if FExperiment.PlayerFromID[Self.ID].Turn = 0 then
- begin
- EnablePlayerMatrix(Self.ID, 0, True);
- ShowPopUp('É sua vez! Clique sobre uma linha da matrix e confirme sua escolha.');
- end
+ EnablePlayerMatrix(Self.ID, 0, True)
else
ShowPopUp('Começou! Aguarde sua vez.');
@@ -1055,7 +1057,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
// check if we already know this player
i := FExperiment.PlayerIndexFromID[P.ID];
- if i > -1then
+ if i > -1 then
begin
// then load p data
P := FExperiment.Player[i]
@@ -1105,11 +1107,16 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
// appen matrix type
ARequest.Append(FExperiment.MatrixTypeAsString); // COUNT-4
- // append chat data if allowed
- if FExperiment.SendChatHistoryForNewPlayers then
- ARequest.Append(FormMatrixGame.ChatMemoRecv.Lines.Text) // COUNT-3
+ // append chat data
+ if FExperiment.ShowChat then
+ begin
+ if FExperiment.SendChatHistoryForNewPlayers then
+ ARequest.Append(FormMatrixGame.ChatMemoRecv.Lines.Text) // COUNT-3
+ else
+ ARequest.Append('[CHAT]'); // must append something to keep the message envelop with standard size
+ end
else
- ARequest.Append('[CHAT]'); // must append something to keep the message envelop standard
+ ARequest.Append('[NOCHAT]'); // must append something to keep the message envelop with standard size
// append global configs.
ARequest.Append(BoolToStr(FExperiment.ABPoints)); // COUNT-2
@@ -1145,6 +1152,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
LEndCycle : Boolean;
LEndGeneration: string;
begin
+ LConsequences := '';
{$IFDEF DEBUG}
WriteLn('Count:',FExperiment.Condition[FExperiment.CurrentCondition].Turn.Count, '<', FExperiment.Condition[FExperiment.CurrentCondition].Turn.Value);
{$ENDIF}
@@ -1185,7 +1193,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
begin
ARequest.Append(#32); // 8
if Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) then
- FExperiment.WriteReportRowPrompt;
+ FExperiment.WriteReportRowPrompt; //TODO: FIND WHY OPTIMIZATION 3 GENERATES BUG HERE
FExperiment.Clean;
end;
@@ -1223,7 +1231,6 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
// return to experiment and present the prompt consequence, if any
if FExperiment.Condition[FExperiment.CurrentCondition].Prompt.ResponsesCount = FExperiment.PlayersCount then
begin
-
// generate messages
LPromptConsequences := FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AsString;
SetLength(M, 3+LPromptConsequences.Count);
@@ -1243,7 +1250,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
end
else;
- // send identified messages; each player takes only its own message and ignore the rest
+ // send identified messages; each player takes only its own message and ignore the rest
FZMQActor.SendMessage(M);
FExperiment.WriteReportRowPrompt;
FExperiment.Clean;
@@ -1263,7 +1270,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
P.Nicname := InputBox
(
'Mudança de geração',
- 'Um novo participante entrou no lugar do participante mais antigo.Qual o apelido do novo participante?',
+ 'Um novo participante entrou no lugar do participante mais antigo. Qual o apelido do novo participante?',
GenResourceName(-1)
);
@@ -1312,9 +1319,15 @@ procedure TGameControl.ReceiveReply(AReply: TStringList);
// set matrix type/ stringgrid
FExperiment.MatrixTypeAsString:=AReply[AReply.Count-4];
- // add chat
- FormMatrixGame.ChatMemoRecv.Lines.Clear;
- FormMatrixGame.ChatMemoRecv.Lines.Add(AReply[AReply.Count-3]);
+ // enable chat
+ if AReply[AReply.Count-3] = '[NOCHAT]' then
+ FormMatrixGame.ChatPanel.Visible := False
+ else
+ begin
+ FormMatrixGame.ChatPanel.Visible := True;
+ FormMatrixGame.ChatMemoRecv.Lines.Clear;
+ FormMatrixGame.ChatMemoRecv.Lines.Append(AReply[AReply.Count-3]);
+ end;
// set global configs
FExperiment.ABPoints := StrToBool(AReply[AReply.Count-2]);
@@ -1322,7 +1335,10 @@ procedure TGameControl.ReceiveReply(AReply: TStringList);
FormMatrixGame.GBIndividual.Visible:= not FormMatrixGame.GBIndividualAB.Visible;
// set condition specific configurations
- NextConditionSetup(AReply[AReply.Count-1])
+ NextConditionSetup(AReply[AReply.Count-1]);
+
+ // set fullscreen
+ FormMatrixGame.SetFullscreen;
end
else
begin
diff --git a/experiment_runner/units/game_experiment.pas b/experiment_runner/units/game_experiment.pas
index 55d5d13..ca1ff5e 100644
--- a/experiment_runner/units/game_experiment.pas
+++ b/experiment_runner/units/game_experiment.pas
@@ -143,6 +143,7 @@ type
function AppendContingency(ACondition : integer;AContingency : TContingency) : integer;overload;
function AppendPlayer : integer;overload;
function AppendPlayer(APlayer : TPlayer) : integer; overload;
+ function TargetIntelockingFired : Boolean;
property Condition[I : Integer]: TCondition read GetCondition write SetCondition;
property ConditionsCount : integer read GetConditionsCount;
property CurrentCondition : integer read FCurrentCondition write FCurrentCondition;
@@ -300,8 +301,19 @@ end;
function TExperiment.GetPlayer(AID: UTF8string): TPlayer;
var
i : integer;
-begin
- //Result.ID := '';
+ P : TPlayer = (
+ ID : '';
+ Nicname : '';
+ Login: '';
+ Password: '';
+ Status : gpsWaiting;
+ Data : nil;
+ Choice : (Row:grNone; Color:gcNone);
+ Points : (A:0; B:0);
+ Turn : -1;
+ );
+begin
+ Result := P;
if PlayersCount > 0 then
for i:= 0 to PlayersCount -1 do
if FPlayers[i].ID = AID then
@@ -746,7 +758,7 @@ begin
LRow += 'NA'+#9;
FRegData.SaveData(LRow);
- FReportReader.Extend(LRow);
+ FReportReader.Extend(LRow); // Write, i.e, extend last row
end;
end;
@@ -886,6 +898,18 @@ begin
FPlayers[Result] := APlayer;
end;
+function TExperiment.TargetIntelockingFired: Boolean;
+var i : integer;
+begin
+ Result := False;
+ for i:= 0 to ContingenciesCount[CurrentCondition]-1 do
+ if Condition[CurrentCondition].Contingencies[i].Meta then
+ begin
+ Result := Condition[CurrentCondition].Contingencies[i].Fired;
+ Break;
+ end;
+end;
+
function TExperiment.ShouldEndCondition: Boolean;
var
LInterlocks: Real;
@@ -960,7 +984,7 @@ begin
for i := 0 to ContingenciesCount[c]-1 do
Contingency[c,i].Clean;
- if Assigned(Condition[c].Prompt) then
+ if Assigned(Condition[c].Prompt) then // TODO: FIND WHY OPTIMIZATION 3 GENERATES BUG HERE
Condition[c].Prompt.Clean;
FRegData.CloseAndOpen;
diff --git a/experiment_runner/units/game_file_methods.pas b/experiment_runner/units/game_file_methods.pas
index 377b38f..e369bac 100644
--- a/experiment_runner/units/game_file_methods.pas
+++ b/experiment_runner/units/game_file_methods.pas
@@ -35,6 +35,7 @@ implementation
uses LCLIntf, game_resources, game_actors, game_actors_helpers, string_methods, regdata;
+// for dev only
function LoadExperimentFromResource(var AExperiment: TExperiment): Boolean;
var
C : TCondition;
@@ -68,6 +69,7 @@ begin
begin
ExperimentName:='test_experiment';
ExperimentAim:='This is a test experiment.';
+ ShowChat := True;
Researcher := VAL_RESEARCHER;
ResearcherCanPlay:=False;
ResearcherCanChat:=True;
@@ -169,6 +171,7 @@ var
AExperiment.ExperimentAim:=ReadString(SEC_EXPERIMENT, KEY_AIM,'');
// general configs
+ AExperiment.ShowChat := ReadBool(SEC_EXPERIMENT, KEY_CHAT_FOR_PLAYERS, False);
AExperiment.ResearcherCanPlay := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY,False);
AExperiment.ResearcherCanChat := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT,False);
AExperiment.GenPlayersAsNeeded := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED,False);
@@ -177,7 +180,7 @@ var
AExperiment.MatrixType := GetMatrixTypeFromString(ReadString(SEC_EXPERIMENT,KEY_MATRIX_TYPE,DEF_MATRIX_TYPE));
// used when loading from paused experiments
- AExperiment.CurrentCondition := ReadInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION,0)-1; //zero based
+ AExperiment.CurrentCondition := ReadInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION,0); //zero based
end;
end;
@@ -256,7 +259,7 @@ var
Turn.Random:= ReadBool(LS, KEY_TURN_RANDOM,False);
Cycles.Count:= ReadInteger(LS, KEY_CYCLES_COUNT,0);
Cycles.Value:= ReadInteger(LS, KEY_CYCLES_VALUE,10);
- Cycles.Generation:= ReadInteger(LS, KEY_CYCLES_GEN,5);
+ Cycles.Generation:= ReadInteger(LS, KEY_CYCLES_GEN,0);
EndCriterium.Style := GetEndCriteriaStyleFromString(ReadString(LS,KEY_ENDCRITERIA,DEF_END_CRITERIA_STYLE));
EndCriterium.AbsoluteCycles:=ReadInteger(LS,KEY_ENDCRITERIA_CYCLES,20);
s1 := ReadString(LS,KEY_ENDCRITERIA_PORCENTAGE,DEF_END_CRITERIA_PORCENTAGE);
@@ -383,9 +386,23 @@ begin
LIniFile:= TIniFile.Create(LWriter.FileName);
LWriter.Free;
- LIniFile.WriteString(SEC_EXPERIMENT,KEY_RESEARCHER,AExperiment.Researcher);
-
+ // write experiment
with LIniFile do
+ begin
+ WriteString(SEC_EXPERIMENT, KEY_RESEARCHER, AExperiment.Researcher);
+ WriteString(SEC_EXPERIMENT, KEY_NAME, AExperiment.ExperimentName);
+ WriteString(SEC_EXPERIMENT, KEY_AIM, AExperiment.ExperimentAim);
+ WriteBool(SEC_EXPERIMENT, KEY_CHAT_FOR_PLAYERS, AExperiment.ShowChat);
+ WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, AExperiment.ResearcherCanPlay);
+ WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, AExperiment.ResearcherCanChat);
+ WriteBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, AExperiment.GenPlayersAsNeeded);
+ WriteBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, AExperiment.SendChatHistoryForNewPlayers);
+ WriteBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, AExperiment.ABPoints);
+ WriteString(SEC_EXPERIMENT,KEY_MATRIX_TYPE,GetMatrixTypeString(AExperiment.MatrixType));
+ WriteInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION, AExperiment.CurrentCondition);
+ end;
+
+ with LIniFile do // write conditions
for i := 0 to AExperiment.ConditionsCount-1 do
begin
LC := SEC_CONDITION+IntToStr(i+1);
@@ -415,7 +432,7 @@ begin
MI := 0;
CI := 0;
- for j := 0 to High(Contingencies) do
+ for j := 0 to High(Contingencies) do // write ocntingencies
begin
if Contingencies[j].Meta then
begin
diff --git a/experiment_runner/units/game_resources.pas b/experiment_runner/units/game_resources.pas
index d371560..57f7fc1 100644
--- a/experiment_runner/units/game_resources.pas
+++ b/experiment_runner/units/game_resources.pas
@@ -28,6 +28,7 @@ resourcestring
KEY_RESEARCHER_CANCHAT = 'Pesquisador.BatePapo';
KEY_RESEARCHER_CANPLAY = 'Pesquisador.PodeJogar';
KEY_GEN_PLAYER_AS_NEEDED = 'Jogadores.GerarAutomaticamente';
+ KEY_CHAT_FOR_PLAYERS = 'Jogadores.BatePapo';
KEY_CHAT_HISTORY_FOR_NEW_PLAYERS = 'Jogadores.Novos.Enviar_Histórico_do_BatePapo';
KEY_CURRENT_CONDITION = 'ComeçarNaCondição';
KEY_MATRIX_TYPE= 'TipoDaMatrix';
--
libgit2 0.21.2