Commit 15518a428a79a1d489f2e00f49219287c5ef526a

Authored by Carlos Picanco
1 parent f214aa24
Exists in master

change compilation rule, bug fixes and improvements

- need to investigate why we getting Runtime 216 errors when compiling with optimization 3
- fix harcoded value on function TGameControl.ShouldAskQuestion
- increase system messages time to 15000 ms
- show system message on start turn
- add 'KEY_CHAT_FOR_PLAYERS' key for disabling chat for players and admins on Runner, need to update Designer
- add fullscreen on player login
- fix bug on loading key 'KEY_CYCLES_GEN'
- need to test save, resume and cancel experiment
experiment_runner/experiment_runner.lpi
@@ -14,7 +14,11 @@ @@ -14,7 +14,11 @@
14 <EnableI18N LFM="False"/> 14 <EnableI18N LFM="False"/>
15 </i18n> 15 </i18n>
16 <VersionInfo> 16 <VersionInfo>
17 - <StringTable ProductVersion=""/> 17 + <UseVersionInfo Value="True"/>
  18 + <AutoIncrementBuild Value="True"/>
  19 + <MinorVersionNr Value="1"/>
  20 + <Language Value="0416"/>
  21 + <StringTable Comments="https://github.com/lacs-ufpa/free-mtrix" CompanyName="Laboratório de Comportamento Social e Seleção Cultural" FileDescription="Experimentos livres de seleção cultural e comportamento social." LegalCopyright="Copyright (C) Carlos Rafael Fernandes Picanço, Universidade Federal do Pará." OriginalFilename="experiment_runner" ProductName="Free-mtrix" ProductVersion="0.1.0"/>
18 </VersionInfo> 22 </VersionInfo>
19 <BuildModes Count="4"> 23 <BuildModes Count="4">
20 <Item1 Name="Linux 64 Debug" Default="True"/> 24 <Item1 Name="Linux 64 Debug" Default="True"/>
@@ -30,18 +34,10 @@ @@ -30,18 +34,10 @@
30 <OtherUnitFiles Value="units;../dependencies/delphizmq"/> 34 <OtherUnitFiles Value="units;../dependencies/delphizmq"/>
31 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 35 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
32 </SearchPaths> 36 </SearchPaths>
33 - <CodeGeneration>  
34 - <SmartLinkUnit Value="True"/>  
35 - <Optimizations>  
36 - <OptimizationLevel Value="3"/>  
37 - </Optimizations>  
38 - </CodeGeneration>  
39 <Linking> 37 <Linking>
40 <Debugging> 38 <Debugging>
41 - <GenerateDebugInfo Value="False"/>  
42 - <StripSymbols Value="True"/> 39 + <UseExternalDbgSyms Value="True"/>
43 </Debugging> 40 </Debugging>
44 - <LinkSmart Value="True"/>  
45 <Options> 41 <Options>
46 <Win32> 42 <Win32>
47 <GraphicApplication Value="True"/> 43 <GraphicApplication Value="True"/>
@@ -86,18 +82,10 @@ @@ -86,18 +82,10 @@
86 <OtherUnitFiles Value="units;../dependencies/delphizmq"/> 82 <OtherUnitFiles Value="units;../dependencies/delphizmq"/>
87 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 83 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
88 </SearchPaths> 84 </SearchPaths>
89 - <CodeGeneration>  
90 - <SmartLinkUnit Value="True"/>  
91 - <Optimizations>  
92 - <OptimizationLevel Value="4"/>  
93 - </Optimizations>  
94 - </CodeGeneration>  
95 <Linking> 85 <Linking>
96 <Debugging> 86 <Debugging>
97 - <GenerateDebugInfo Value="False"/>  
98 - <StripSymbols Value="True"/> 87 + <UseExternalDbgSyms Value="True"/>
99 </Debugging> 88 </Debugging>
100 - <LinkSmart Value="True"/>  
101 <Options> 89 <Options>
102 <Win32> 90 <Win32>
103 <GraphicApplication Value="True"/> 91 <GraphicApplication Value="True"/>
experiment_runner/form_matrixgame.lfm
@@ -7,7 +7,7 @@ object FormMatrixGame: TFormMatrixGame @@ -7,7 +7,7 @@ object FormMatrixGame: TFormMatrixGame
7 VertScrollBar.Page = 542 7 VertScrollBar.Page = 542
8 AutoScroll = True 8 AutoScroll = True
9 Caption = 'Matrix' 9 Caption = 'Matrix'
10 - ClientHeight = 609 10 + ClientHeight = 616
11 ClientWidth = 1167 11 ClientWidth = 1167
12 Font.Name = 'Monospace' 12 Font.Name = 'Monospace'
13 OnActivate = FormActivate 13 OnActivate = FormActivate
@@ -16,24 +16,24 @@ object FormMatrixGame: TFormMatrixGame @@ -16,24 +16,24 @@ object FormMatrixGame: TFormMatrixGame
16 AnchorSideLeft.Control = GBIndividualAB 16 AnchorSideLeft.Control = GBIndividualAB
17 AnchorSideTop.Control = GBIndividualAB 17 AnchorSideTop.Control = GBIndividualAB
18 Left = 800 18 Left = 800
19 - Height = 131 19 + Height = 122
20 Top = 8 20 Top = 8
21 - Width = 162 21 + Width = 170
22 AutoSize = True 22 AutoSize = True
23 Caption = 'Pontuação Individual' 23 Caption = 'Pontuação Individual'
24 ChildSizing.LeftRightSpacing = 35 24 ChildSizing.LeftRightSpacing = 35
25 ChildSizing.TopBottomSpacing = 45 25 ChildSizing.TopBottomSpacing = 45
26 ChildSizing.Layout = cclLeftToRightThenTopToBottom 26 ChildSizing.Layout = cclLeftToRightThenTopToBottom
27 ChildSizing.ControlsPerLine = 1 27 ChildSizing.ControlsPerLine = 1
28 - ClientHeight = 108  
29 - ClientWidth = 158 28 + ClientHeight = 105
  29 + ClientWidth = 166
30 TabOrder = 7 30 TabOrder = 7
31 Visible = False 31 Visible = False
32 object LabelIndCount: TLabel 32 object LabelIndCount: TLabel
33 Left = 35 33 Left = 35
34 - Height = 18 34 + Height = 15
35 Top = 45 35 Top = 45
36 - Width = 88 36 + Width = 96
37 Align = alClient 37 Align = alClient
38 Alignment = taCenter 38 Alignment = taCenter
39 AutoSize = False 39 AutoSize = False
@@ -71,9 +71,9 @@ object FormMatrixGame: TFormMatrixGame @@ -71,9 +71,9 @@ object FormMatrixGame: TFormMatrixGame
71 end 71 end
72 object GBIndividualAB: TGroupBox 72 object GBIndividualAB: TGroupBox
73 Left = 800 73 Left = 800
74 - Height = 135 74 + Height = 122
75 Top = 8 75 Top = 8
76 - Width = 162 76 + Width = 170
77 AutoSize = True 77 AutoSize = True
78 Caption = 'Pontuação Individual' 78 Caption = 'Pontuação Individual'
79 ChildSizing.LeftRightSpacing = 10 79 ChildSizing.LeftRightSpacing = 10
@@ -83,14 +83,14 @@ object FormMatrixGame: TFormMatrixGame @@ -83,14 +83,14 @@ object FormMatrixGame: TFormMatrixGame
83 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize 83 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
84 ChildSizing.Layout = cclLeftToRightThenTopToBottom 84 ChildSizing.Layout = cclLeftToRightThenTopToBottom
85 ChildSizing.ControlsPerLine = 2 85 ChildSizing.ControlsPerLine = 2
86 - ClientHeight = 112  
87 - ClientWidth = 158 86 + ClientHeight = 105
  87 + ClientWidth = 166
88 TabOrder = 1 88 TabOrder = 1
89 object LabelIndA: TLabel 89 object LabelIndA: TLabel
90 Left = 10 90 Left = 10
91 - Height = 19 91 + Height = 15
92 Top = 30 92 Top = 30
93 - Width = 59 93 + Width = 63
94 Alignment = taCenter 94 Alignment = taCenter
95 AutoSize = False 95 AutoSize = False
96 Caption = 'A' 96 Caption = 'A'
@@ -103,10 +103,10 @@ object FormMatrixGame: TFormMatrixGame @@ -103,10 +103,10 @@ object FormMatrixGame: TFormMatrixGame
103 Transparent = False 103 Transparent = False
104 end 104 end
105 object LabelIndB: TLabel 105 object LabelIndB: TLabel
106 - Left = 89  
107 - Height = 19 106 + Left = 93
  107 + Height = 15
108 Top = 30 108 Top = 30
109 - Width = 59 109 + Width = 63
110 Alignment = taCenter 110 Alignment = taCenter
111 AutoSize = False 111 AutoSize = False
112 Caption = 'B' 112 Caption = 'B'
@@ -120,9 +120,9 @@ object FormMatrixGame: TFormMatrixGame @@ -120,9 +120,9 @@ object FormMatrixGame: TFormMatrixGame
120 end 120 end
121 object LabelIndACount: TLabel 121 object LabelIndACount: TLabel
122 Left = 10 122 Left = 10
123 - Height = 18  
124 - Top = 64  
125 - Width = 59 123 + Height = 15
  124 + Top = 60
  125 + Width = 63
126 Alignment = taCenter 126 Alignment = taCenter
127 AutoSize = False 127 AutoSize = False
128 Caption = '0' 128 Caption = '0'
@@ -131,10 +131,10 @@ object FormMatrixGame: TFormMatrixGame @@ -131,10 +131,10 @@ object FormMatrixGame: TFormMatrixGame
131 Transparent = False 131 Transparent = False
132 end 132 end
133 object LabelIndBCount: TLabel 133 object LabelIndBCount: TLabel
134 - Left = 89  
135 - Height = 18  
136 - Top = 64  
137 - Width = 59 134 + Left = 93
  135 + Height = 15
  136 + Top = 60
  137 + Width = 63
138 Alignment = taCenter 138 Alignment = taCenter
139 AutoSize = False 139 AutoSize = False
140 Caption = '0' 140 Caption = '0'
@@ -147,10 +147,10 @@ object FormMatrixGame: TFormMatrixGame @@ -147,10 +147,10 @@ object FormMatrixGame: TFormMatrixGame
147 AnchorSideLeft.Control = GBIndividualAB 147 AnchorSideLeft.Control = GBIndividualAB
148 AnchorSideLeft.Side = asrBottom 148 AnchorSideLeft.Side = asrBottom
149 AnchorSideTop.Control = GBIndividualAB 149 AnchorSideTop.Control = GBIndividualAB
150 - Left = 972  
151 - Height = 131 150 + Left = 980
  151 + Height = 122
152 Top = 8 152 Top = 8
153 - Width = 171 153 + Width = 170
154 AutoSize = True 154 AutoSize = True
155 BorderSpacing.Left = 10 155 BorderSpacing.Left = 10
156 Caption = ' Pontuação do Grupo ' 156 Caption = ' Pontuação do Grupo '
@@ -158,14 +158,14 @@ object FormMatrixGame: TFormMatrixGame @@ -158,14 +158,14 @@ object FormMatrixGame: TFormMatrixGame
158 ChildSizing.TopBottomSpacing = 45 158 ChildSizing.TopBottomSpacing = 45
159 ChildSizing.Layout = cclLeftToRightThenTopToBottom 159 ChildSizing.Layout = cclLeftToRightThenTopToBottom
160 ChildSizing.ControlsPerLine = 1 160 ChildSizing.ControlsPerLine = 1
161 - ClientHeight = 108  
162 - ClientWidth = 167 161 + ClientHeight = 105
  162 + ClientWidth = 166
163 TabOrder = 2 163 TabOrder = 2
164 object LabelGroupCount: TLabel 164 object LabelGroupCount: TLabel
165 Left = 35 165 Left = 35
166 - Height = 18 166 + Height = 15
167 Top = 45 167 Top = 45
168 - Width = 97 168 + Width = 96
169 Align = alClient 169 Align = alClient
170 Alignment = taCenter 170 Alignment = taCenter
171 AutoSize = False 171 AutoSize = False
@@ -183,9 +183,9 @@ object FormMatrixGame: TFormMatrixGame @@ -183,9 +183,9 @@ object FormMatrixGame: TFormMatrixGame
183 AnchorSideBottom.Control = Owner 183 AnchorSideBottom.Control = Owner
184 AnchorSideBottom.Side = asrBottom 184 AnchorSideBottom.Side = asrBottom
185 Left = 0 185 Left = 0
186 - Height = 22  
187 - Top = 587  
188 - Width = 1625 186 + Height = 17
  187 + Top = 599
  188 + Width = 1632
189 Anchors = [akLeft, akRight, akBottom] 189 Anchors = [akLeft, akRight, akBottom]
190 AutoSize = True 190 AutoSize = True
191 Caption = 'Escolhas na última jogada' 191 Caption = 'Escolhas na última jogada'
@@ -200,21 +200,21 @@ object FormMatrixGame: TFormMatrixGame @@ -200,21 +200,21 @@ object FormMatrixGame: TFormMatrixGame
200 AnchorSideLeft.Control = GBGrupo 200 AnchorSideLeft.Control = GBGrupo
201 AnchorSideLeft.Side = asrBottom 201 AnchorSideLeft.Side = asrBottom
202 AnchorSideTop.Control = GBGrupo 202 AnchorSideTop.Control = GBGrupo
203 - Left = 1153 203 + Left = 1160
204 Height = 486 204 Height = 486
205 Top = 8 205 Top = 8
206 Width = 472 206 Width = 472
207 BorderSpacing.Left = 10 207 BorderSpacing.Left = 10
208 Caption = 'Pesquisador' 208 Caption = 'Pesquisador'
209 - ClientHeight = 463 209 + ClientHeight = 469
210 ClientWidth = 468 210 ClientWidth = 468
211 TabOrder = 4 211 TabOrder = 4
212 Visible = False 212 Visible = False
213 object GBExperiment: TGroupBox 213 object GBExperiment: TGroupBox
214 Left = 16 214 Left = 16
215 - Height = 221 215 + Height = 197
216 Top = 60 216 Top = 60
217 - Width = 220 217 + Width = 228
218 AutoSize = True 218 AutoSize = True
219 Caption = 'Experimento' 219 Caption = 'Experimento'
220 ChildSizing.LeftRightSpacing = 10 220 ChildSizing.LeftRightSpacing = 10
@@ -224,102 +224,102 @@ object FormMatrixGame: TFormMatrixGame @@ -224,102 +224,102 @@ object FormMatrixGame: TFormMatrixGame
224 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize 224 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
225 ChildSizing.Layout = cclLeftToRightThenTopToBottom 225 ChildSizing.Layout = cclLeftToRightThenTopToBottom
226 ChildSizing.ControlsPerLine = 2 226 ChildSizing.ControlsPerLine = 2
227 - ClientHeight = 198  
228 - ClientWidth = 216 227 + ClientHeight = 180
  228 + ClientWidth = 224
229 TabOrder = 0 229 TabOrder = 0
230 object LabelExpCond: TLabel 230 object LabelExpCond: TLabel
231 Left = 10 231 Left = 10
232 - Height = 18 232 + Height = 15
233 Top = 20 233 Top = 20
234 - Width = 154 234 + Width = 168
235 Caption = 'Condição:' 235 Caption = 'Condição:'
236 ParentColor = False 236 ParentColor = False
237 end 237 end
238 object LabelExpCountCondition: TLabel 238 object LabelExpCountCondition: TLabel
239 - Left = 184  
240 - Height = 18 239 + Left = 198
  240 + Height = 15
241 Top = 20 241 Top = 20
242 - Width = 22 242 + Width = 16
243 Caption = 'NA' 243 Caption = 'NA'
244 ParentColor = False 244 ParentColor = False
245 end 245 end
246 object LabelExpGen: TLabel 246 object LabelExpGen: TLabel
247 Left = 10 247 Left = 10
248 - Height = 18  
249 - Top = 48  
250 - Width = 154 248 + Height = 15
  249 + Top = 45
  250 + Width = 168
251 Caption = 'Geração:' 251 Caption = 'Geração:'
252 ParentColor = False 252 ParentColor = False
253 end 253 end
254 object LabelExpCountGeneration: TLabel 254 object LabelExpCountGeneration: TLabel
255 - Left = 184  
256 - Height = 18  
257 - Top = 48  
258 - Width = 22 255 + Left = 198
  256 + Height = 15
  257 + Top = 45
  258 + Width = 16
259 Caption = 'NA' 259 Caption = 'NA'
260 ParentColor = False 260 ParentColor = False
261 end 261 end
262 object LabelExpCycle: TLabel 262 object LabelExpCycle: TLabel
263 Left = 10 263 Left = 10
264 - Height = 18  
265 - Top = 76  
266 - Width = 154 264 + Height = 15
  265 + Top = 70
  266 + Width = 168
267 Caption = 'Ciclo:' 267 Caption = 'Ciclo:'
268 ParentColor = False 268 ParentColor = False
269 end 269 end
270 object LabelExpCountCycle: TLabel 270 object LabelExpCountCycle: TLabel
271 - Left = 184  
272 - Height = 18  
273 - Top = 76  
274 - Width = 22 271 + Left = 198
  272 + Height = 15
  273 + Top = 70
  274 + Width = 16
275 Caption = 'NA' 275 Caption = 'NA'
276 ParentColor = False 276 ParentColor = False
277 end 277 end
278 object LabelExpTurn: TLabel 278 object LabelExpTurn: TLabel
279 Left = 10 279 Left = 10
280 - Height = 18  
281 - Top = 104  
282 - Width = 154 280 + Height = 15
  281 + Top = 95
  282 + Width = 168
283 Caption = 'Turno:' 283 Caption = 'Turno:'
284 ParentColor = False 284 ParentColor = False
285 end 285 end
286 object LabelExpCountTurn: TLabel 286 object LabelExpCountTurn: TLabel
287 - Left = 184  
288 - Height = 18  
289 - Top = 104  
290 - Width = 22 287 + Left = 198
  288 + Height = 15
  289 + Top = 95
  290 + Width = 16
291 Caption = 'NA' 291 Caption = 'NA'
292 ParentColor = False 292 ParentColor = False
293 end 293 end
294 object LabelExpInterlocks: TLabel 294 object LabelExpInterlocks: TLabel
295 Left = 10 295 Left = 10
296 - Height = 18  
297 - Top = 132  
298 - Width = 154 296 + Height = 15
  297 + Top = 120
  298 + Width = 168
299 Caption = 'Entrelaçamentos:' 299 Caption = 'Entrelaçamentos:'
300 ParentColor = False 300 ParentColor = False
301 end 301 end
302 object LabelExpCountInterlocks: TLabel 302 object LabelExpCountInterlocks: TLabel
303 - Left = 184  
304 - Height = 18  
305 - Top = 132  
306 - Width = 22 303 + Left = 198
  304 + Height = 15
  305 + Top = 120
  306 + Width = 16
307 Caption = 'NA' 307 Caption = 'NA'
308 ParentColor = False 308 ParentColor = False
309 end 309 end
310 object LabelExpTInterlocks: TLabel 310 object LabelExpTInterlocks: TLabel
311 Left = 10 311 Left = 10
312 - Height = 18  
313 - Top = 160  
314 - Width = 154 312 + Height = 15
  313 + Top = 145
  314 + Width = 168
315 Caption = 'Entrelaçamentos Alvo:' 315 Caption = 'Entrelaçamentos Alvo:'
316 ParentColor = False 316 ParentColor = False
317 end 317 end
318 object LabelExpCountTInterlocks: TLabel 318 object LabelExpCountTInterlocks: TLabel
319 - Left = 184  
320 - Height = 18  
321 - Top = 160  
322 - Width = 22 319 + Left = 198
  320 + Height = 15
  321 + Top = 145
  322 + Width = 16
323 Caption = 'NA' 323 Caption = 'NA'
324 ParentColor = False 324 ParentColor = False
325 end 325 end
@@ -372,19 +372,19 @@ object FormMatrixGame: TFormMatrixGame @@ -372,19 +372,19 @@ object FormMatrixGame: TFormMatrixGame
372 AnchorSideRight.Side = asrBottom 372 AnchorSideRight.Side = asrBottom
373 Left = 800 373 Left = 800
374 Height = 354 374 Height = 354
375 - Top = 153  
376 - Width = 343 375 + Top = 140
  376 + Width = 350
377 Anchors = [akTop, akLeft, akRight] 377 Anchors = [akTop, akLeft, akRight]
378 BorderSpacing.Top = 10 378 BorderSpacing.Top = 10
379 ClientHeight = 354 379 ClientHeight = 354
380 - ClientWidth = 343 380 + ClientWidth = 350
381 TabOrder = 6 381 TabOrder = 6
382 object ChatMemoRecv: TMemo 382 object ChatMemoRecv: TMemo
383 AnchorSideBottom.Control = ChatSplitter 383 AnchorSideBottom.Control = ChatSplitter
384 Left = 6 384 Left = 6
385 Height = 221 385 Height = 221
386 Top = 6 386 Top = 6
387 - Width = 331 387 + Width = 338
388 Align = alTop 388 Align = alTop
389 Anchors = [akTop, akLeft, akRight, akBottom] 389 Anchors = [akTop, akLeft, akRight, akBottom]
390 BorderSpacing.Left = 5 390 BorderSpacing.Left = 5
@@ -405,7 +405,7 @@ object FormMatrixGame: TFormMatrixGame @@ -405,7 +405,7 @@ object FormMatrixGame: TFormMatrixGame
405 Left = 0 405 Left = 0
406 Height = 5 406 Height = 5
407 Top = 232 407 Top = 232
408 - Width = 341 408 + Width = 348
409 Align = alNone 409 Align = alNone
410 Anchors = [akLeft, akRight] 410 Anchors = [akLeft, akRight]
411 ResizeAnchor = akTop 411 ResizeAnchor = akTop
@@ -416,7 +416,7 @@ object FormMatrixGame: TFormMatrixGame @@ -416,7 +416,7 @@ object FormMatrixGame: TFormMatrixGame
416 Left = 6 416 Left = 6
417 Height = 106 417 Height = 106
418 Top = 242 418 Top = 242
419 - Width = 331 419 + Width = 338
420 Align = alBottom 420 Align = alBottom
421 Anchors = [akTop, akLeft, akRight, akBottom] 421 Anchors = [akTop, akLeft, akRight, akBottom]
422 BorderSpacing.Around = 5 422 BorderSpacing.Around = 5
@@ -439,7 +439,7 @@ object FormMatrixGame: TFormMatrixGame @@ -439,7 +439,7 @@ object FormMatrixGame: TFormMatrixGame
439 top = 360 439 top = 360
440 end 440 end
441 object PopupNotifier: TPopupNotifier 441 object PopupNotifier: TPopupNotifier
442 - Color = clTeal 442 + Color = clDefault
443 Icon.Data = { 443 Icon.Data = {
444 07544269746D617000000000 444 07544269746D617000000000
445 } 445 }
experiment_runner/form_matrixgame.pas
@@ -80,6 +80,7 @@ type @@ -80,6 +80,7 @@ type
80 public 80 public
81 procedure SetID(S : string); 81 procedure SetID(S : string);
82 procedure SetGameActor(AValue: TGameActor); 82 procedure SetGameActor(AValue: TGameActor);
  83 + procedure SetFullscreen;
83 property ID : string read FID; 84 property ID : string read FID;
84 end; 85 end;
85 86
@@ -248,6 +249,17 @@ begin @@ -248,6 +249,17 @@ begin
248 end; 249 end;
249 end; 250 end;
250 251
  252 +procedure TFormMatrixGame.SetFullscreen;
  253 +begin
  254 + BorderStyle:=bsNone;
  255 + {$IFDEF WINDOWS}
  256 + BoundsRect := Monitor.BoundsRect;
  257 + {$ENDIF}
  258 + Position:=poDesigned;
  259 + FormStyle:=fsNormal;
  260 + WindowState:=wsFullScreen;
  261 +end;
  262 +
251 procedure TFormMatrixGame.SetID(S: string); 263 procedure TFormMatrixGame.SetID(S: string);
252 begin 264 begin
253 FID := S; 265 FID := S;
@@ -256,6 +268,7 @@ end; @@ -256,6 +268,7 @@ end;
256 268
257 procedure TFormMatrixGame.FormActivate(Sender: TObject); 269 procedure TFormMatrixGame.FormActivate(Sender: TObject);
258 begin 270 begin
  271 + PopupNotifier.Icon.Assign(Application.Icon);
259 if not Assigned(FGameControl) then 272 if not Assigned(FGameControl) then
260 begin 273 begin
261 FormChooseActor := TFormChooseActor.Create(Self); 274 FormChooseActor := TFormChooseActor.Create(Self);
@@ -319,15 +332,15 @@ begin @@ -319,15 +332,15 @@ begin
319 ButtonExpStart.Caption := CAPTION_START; 332 ButtonExpStart.Caption := CAPTION_START;
320 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled; 333 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
321 ButtonExpPause.Enabled := not ButtonExpStart.Enabled; 334 ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
322 - //FGameControl.Experiment.SaveToFile(SaveDialog.FileName'.canceled');  
323 - //FGameControl.Experiment.Clean; 335 + FGameControl.Experiment.SaveToFile(OpenDialog.FileName+'.canceled');
  336 + FGameControl.SendMessage(K_END);
324 end; 337 end;
325 338
326 procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject); 339 procedure TFormMatrixGame.ButtonExpPauseClick(Sender: TObject);
327 begin 340 begin
328 - ButtonExpStart.Enabled := True;  
329 - ButtonExpStart.Caption := CAPTION_RESUME;  
330 - ButtonExpPause.Enabled := not ButtonExpStart.Enabled; 341 + //ButtonExpStart.Enabled := True;
  342 + //ButtonExpStart.Caption := CAPTION_RESUME;
  343 + //ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
331 //FGameControl.Pause; 344 //FGameControl.Pause;
332 end; 345 end;
333 346
@@ -344,7 +357,7 @@ begin @@ -344,7 +357,7 @@ begin
344 ButtonExpStart.Caption := CAPTION_RUNNING; 357 ButtonExpStart.Caption := CAPTION_RUNNING;
345 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled; 358 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
346 ButtonExpPause.Enabled := not ButtonExpStart.Enabled; 359 ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
347 - 360 + ChatPanel.Visible := FGameControl.Experiment.ShowChat;
348 end; 361 end;
349 362
350 if ButtonExpStart.Caption = CAPTION_RESUME then 363 if ButtonExpStart.Caption = CAPTION_RESUME then
@@ -353,7 +366,7 @@ begin @@ -353,7 +366,7 @@ begin
353 ButtonExpStart.Caption := CAPTION_RUNNING; 366 ButtonExpStart.Caption := CAPTION_RUNNING;
354 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled; 367 ButtonExpCancel.Enabled := not ButtonExpStart.Enabled;
355 ButtonExpPause.Enabled := not ButtonExpStart.Enabled; 368 ButtonExpPause.Enabled := not ButtonExpStart.Enabled;
356 - //FGameControl.Resume; 369 + FGameControl.Resume;
357 end; 370 end;
358 end; 371 end;
359 372
experiment_runner/lib/x86_64-linux/experiment_runner.compiled
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <CONFIG> 2 <CONFIG>
3 <Compiler Value="/usr/bin/fpc" Date="1449313866"/> 3 <Compiler Value="/usr/bin/fpc" Date="1449313866"/>
4 - <Params Value=" -MObjFPC -Scghi -CX -Cg -O3 -Xs -XX -l -vewnhibq -Fi/home/rafael/git/sc_split/experiment_runner/lib/x86_64-linux -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9 -Fl/opt/gnome/lib -Fu/home/rafael/git/sc_split/experiment_runner/units -Fu/home/rafael/git/sc_split/dependencies/delphizmq -Fu/usr/share/lazarus/1.6.2/lcl/units/x86_64-linux/gtk2 -Fu/usr/share/lazarus/1.6.2/lcl/units/x86_64-linux -Fu/usr/share/lazarus/1.6.2/components/lazutils/lib/x86_64-linux -Fu/usr/share/lazarus/1.6.2/packager/units/x86_64-linux -Fu/home/rafael/git/sc_split/experiment_runner/ -FU/home/rafael/git/sc_split/experiment_runner/lib/x86_64-linux/ -dLCL -dLCLgtk2 -dUseCThreads experiment_runner.lpr"/> 4 + <Params Value=" -MObjFPC -Scghi -Cg -O1 -g -gl -Xg -l -vewnhibq -Fi/home/rafael/git/sc_split/experiment_runner/lib/x86_64-linux -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9 -Fl/opt/gnome/lib -Fu/home/rafael/git/sc_split/experiment_runner/units -Fu/home/rafael/git/sc_split/dependencies/delphizmq -Fu/usr/share/lazarus/1.6.2/lcl/units/x86_64-linux/gtk2 -Fu/usr/share/lazarus/1.6.2/lcl/units/x86_64-linux -Fu/usr/share/lazarus/1.6.2/components/lazutils/lib/x86_64-linux -Fu/usr/share/lazarus/1.6.2/packager/units/x86_64-linux -Fu/home/rafael/git/sc_split/experiment_runner/ -FU/home/rafael/git/sc_split/experiment_runner/lib/x86_64-linux/ -dLCL -dLCLgtk2 -dUseCThreads experiment_runner.lpr"/>
5 </CONFIG> 5 </CONFIG>
experiment_runner/units/game_actors.pas
@@ -442,7 +442,7 @@ end; @@ -442,7 +442,7 @@ end;
442 442
443 procedure TPrompt.ClearResponses; 443 procedure TPrompt.ClearResponses;
444 begin 444 begin
445 - FResponses := nil; 445 + SetLength(FResponses,0);
446 end; 446 end;
447 447
448 constructor TPrompt.Create(AOwner: TComponent; APStyle: TPromptStyle; 448 constructor TPrompt.Create(AOwner: TComponent; APStyle: TPromptStyle;
@@ -473,7 +473,7 @@ end; @@ -473,7 +473,7 @@ end;
473 procedure TPrompt.Clean; 473 procedure TPrompt.Clean;
474 begin 474 begin
475 //inherited Clean; 475 //inherited Clean;
476 - FResponses := nil; 476 + SetLength(FResponses,0);
477 end; 477 end;
478 478
479 function TPrompt.AsString: TStringList; 479 function TPrompt.AsString: TStringList;
experiment_runner/units/game_control.pas
@@ -53,7 +53,7 @@ type @@ -53,7 +53,7 @@ type
53 private 53 private
54 function AskQuestion(AQuestion:string):UTF8string; 54 function AskQuestion(AQuestion:string):UTF8string;
55 function ShowConsequence(AID,S:string;ForGroup:Boolean;ShowPopUp : Boolean = True) : string; 55 function ShowConsequence(AID,S:string;ForGroup:Boolean;ShowPopUp : Boolean = True) : string;
56 - procedure ShowPopUp(AText:string;AInterval : integer = 5000); 56 + procedure ShowPopUp(AText:string;AInterval : integer = 15000);
57 procedure DisableConfirmationButton; 57 procedure DisableConfirmationButton;
58 procedure CleanMatrix(AEnabled : Boolean); 58 procedure CleanMatrix(AEnabled : Boolean);
59 procedure NextConditionSetup(S : string); 59 procedure NextConditionSetup(S : string);
@@ -137,6 +137,7 @@ const @@ -137,6 +137,7 @@ const
137 function GetRowColor(ARow: integer; ARowBase:integer): TColor; 137 function GetRowColor(ARow: integer; ARowBase:integer): TColor;
138 var LRow : integer; 138 var LRow : integer;
139 begin 139 begin
  140 + Result := 0;
140 if ARowBase = 1 then 141 if ARowBase = 1 then
141 LRow := aRow -1 142 LRow := aRow -1
142 else LRow := aRow; 143 else LRow := aRow;
@@ -179,7 +180,7 @@ end; @@ -179,7 +180,7 @@ end;
179 180
180 function TGameControl.ShouldAskQuestion: Boolean; 181 function TGameControl.ShouldAskQuestion: Boolean;
181 begin 182 begin
182 - Result := Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) and FExperiment.Condition[FExperiment.CurrentCondition].Contingencies[3].Fired; 183 + Result := Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) and FExperiment.TargetIntelockingFired;
183 end; 184 end;
184 185
185 procedure TGameControl.EndExperiment(Sender: TObject); 186 procedure TGameControl.EndExperiment(Sender: TObject);
@@ -298,9 +299,8 @@ end; @@ -298,9 +299,8 @@ end;
298 299
299 procedure TGameControl.Stop; 300 procedure TGameControl.Stop;
300 begin 301 begin
301 - // Pause  
302 -  
303 // cleaning 302 // cleaning
  303 + FExperiment.Clean;
304 end; 304 end;
305 305
306 function TGameControl.GetPlayerBox(AID: UTF8string): TPlayerBox; 306 function TGameControl.GetPlayerBox(AID: UTF8string): TPlayerBox;
@@ -317,6 +317,7 @@ end; @@ -317,6 +317,7 @@ end;
317 317
318 function TGameControl.GetActorNicname(AID: UTF8string): UTF8string; 318 function TGameControl.GetActorNicname(AID: UTF8string): UTF8string;
319 begin 319 begin
  320 + Result := '';
320 case FActor of 321 case FActor of
321 gaPlayer: begin 322 gaPlayer: begin
322 Result := 'UNKNOWN'; 323 Result := 'UNKNOWN';
@@ -501,8 +502,8 @@ end; @@ -501,8 +502,8 @@ end;
501 procedure TGameControl.ShowPopUp(AText: string; AInterval: integer); 502 procedure TGameControl.ShowPopUp(AText: string; AInterval: integer);
502 var PopUpPos : TPoint; 503 var PopUpPos : TPoint;
503 begin 504 begin
504 - PopUpPos.X := FormMatrixGame.GBIndividualAB.Left-110;  
505 - PopUpPos.Y := FormMatrixGame.GBIndividualAB.Top+FormMatrixGame.GBIndividual.Height-10; 505 + PopUpPos.X := (FormMatrixGame.StringGridMatrix.Width div 2) - (FormMatrixGame.PopupNotifier.vNotifierForm.Width div 2);
  506 + PopUpPos.Y := (FormMatrixGame.StringGridMatrix.Height div 2) - (FormMatrixGame.PopupNotifier.vNotifierForm.Height div 2);
506 PopUpPos := FormMatrixGame.ClientToScreen(PopUpPos); 507 PopUpPos := FormMatrixGame.ClientToScreen(PopUpPos);
507 FormMatrixGame.PopupNotifier.Title:=''; 508 FormMatrixGame.PopupNotifier.Title:='';
508 FormMatrixGame.PopupNotifier.Text:=AText; 509 FormMatrixGame.PopupNotifier.Text:=AText;
@@ -609,7 +610,7 @@ begin @@ -609,7 +610,7 @@ begin
609 for P in FExperiment.Players do 610 for P in FExperiment.Players do
610 begin 611 begin
611 PB := GetPlayerBox(P.ID); 612 PB := GetPlayerBox(P.ID);
612 - A += StrToInt(PB.LabelPointsCount.Caption) + B; 613 + A += StrToInt(PB.LabelPointsCount.Caption);
613 PB.LabelPointsCount.Caption := IntToStr(A); 614 PB.LabelPointsCount.Caption := IntToStr(A);
614 end; 615 end;
615 end; 616 end;
@@ -620,6 +621,9 @@ procedure TGameControl.EnablePlayerMatrix(AID:UTF8string; ATurn:integer; AEnable @@ -620,6 +621,9 @@ procedure TGameControl.EnablePlayerMatrix(AID:UTF8string; ATurn:integer; AEnable
620 begin 621 begin
621 if FExperiment.PlayerFromID[AID].Turn = ATurn then 622 if FExperiment.PlayerFromID[AID].Turn = ATurn then
622 CleanMatrix(AEnabled); 623 CleanMatrix(AEnabled);
  624 +
  625 + if AEnabled then
  626 + ShowPopUp('É sua vez! Clique sobre uma linha da matrix e confirme sua escolha.');
623 end; 627 end;
624 628
625 constructor TGameControl.Create(AOwner: TComponent;AppPath:string); 629 constructor TGameControl.Create(AOwner: TComponent;AppPath:string);
@@ -681,6 +685,7 @@ var @@ -681,6 +685,7 @@ var
681 M[i] := A[i]; 685 M[i] := A[i];
682 end; 686 end;
683 begin 687 begin
  688 + SetLength(M,0);
684 case ARequest of 689 case ARequest of
685 K_LOGIN :SetM([ 690 K_LOGIN :SetM([
686 FZMQActor.ID 691 FZMQActor.ID
@@ -854,10 +859,7 @@ procedure TGameControl.ReceiveMessage(AMessage: TStringList); @@ -854,10 +859,7 @@ procedure TGameControl.ReceiveMessage(AMessage: TStringList);
854 case FActor of 859 case FActor of
855 gaPlayer: 860 gaPlayer:
856 if FExperiment.PlayerFromID[Self.ID].Turn = 0 then 861 if FExperiment.PlayerFromID[Self.ID].Turn = 0 then
857 - begin  
858 - EnablePlayerMatrix(Self.ID, 0, True);  
859 - ShowPopUp('É sua vez! Clique sobre uma linha da matrix e confirme sua escolha.');  
860 - end 862 + EnablePlayerMatrix(Self.ID, 0, True)
861 else 863 else
862 ShowPopUp('Começou! Aguarde sua vez.'); 864 ShowPopUp('Começou! Aguarde sua vez.');
863 865
@@ -1055,7 +1057,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1055,7 +1057,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1055 1057
1056 // check if we already know this player 1058 // check if we already know this player
1057 i := FExperiment.PlayerIndexFromID[P.ID]; 1059 i := FExperiment.PlayerIndexFromID[P.ID];
1058 - if i > -1then 1060 + if i > -1 then
1059 begin 1061 begin
1060 // then load p data 1062 // then load p data
1061 P := FExperiment.Player[i] 1063 P := FExperiment.Player[i]
@@ -1105,11 +1107,16 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1105,11 +1107,16 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1105 // appen matrix type 1107 // appen matrix type
1106 ARequest.Append(FExperiment.MatrixTypeAsString); // COUNT-4 1108 ARequest.Append(FExperiment.MatrixTypeAsString); // COUNT-4
1107 1109
1108 - // append chat data if allowed  
1109 - if FExperiment.SendChatHistoryForNewPlayers then  
1110 - ARequest.Append(FormMatrixGame.ChatMemoRecv.Lines.Text) // COUNT-3 1110 + // append chat data
  1111 + if FExperiment.ShowChat then
  1112 + begin
  1113 + if FExperiment.SendChatHistoryForNewPlayers then
  1114 + ARequest.Append(FormMatrixGame.ChatMemoRecv.Lines.Text) // COUNT-3
  1115 + else
  1116 + ARequest.Append('[CHAT]'); // must append something to keep the message envelop with standard size
  1117 + end
1111 else 1118 else
1112 - ARequest.Append('[CHAT]'); // must append something to keep the message envelop standard 1119 + ARequest.Append('[NOCHAT]'); // must append something to keep the message envelop with standard size
1113 1120
1114 // append global configs. 1121 // append global configs.
1115 ARequest.Append(BoolToStr(FExperiment.ABPoints)); // COUNT-2 1122 ARequest.Append(BoolToStr(FExperiment.ABPoints)); // COUNT-2
@@ -1145,6 +1152,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1145,6 +1152,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1145 LEndCycle : Boolean; 1152 LEndCycle : Boolean;
1146 LEndGeneration: string; 1153 LEndGeneration: string;
1147 begin 1154 begin
  1155 + LConsequences := '';
1148 {$IFDEF DEBUG} 1156 {$IFDEF DEBUG}
1149 WriteLn('Count:',FExperiment.Condition[FExperiment.CurrentCondition].Turn.Count, '<', FExperiment.Condition[FExperiment.CurrentCondition].Turn.Value); 1157 WriteLn('Count:',FExperiment.Condition[FExperiment.CurrentCondition].Turn.Count, '<', FExperiment.Condition[FExperiment.CurrentCondition].Turn.Value);
1150 {$ENDIF} 1158 {$ENDIF}
@@ -1185,7 +1193,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1185,7 +1193,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1185 begin 1193 begin
1186 ARequest.Append(#32); // 8 1194 ARequest.Append(#32); // 8
1187 if Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) then 1195 if Assigned(FExperiment.Condition[FExperiment.CurrentCondition].Prompt) then
1188 - FExperiment.WriteReportRowPrompt; 1196 + FExperiment.WriteReportRowPrompt; //TODO: FIND WHY OPTIMIZATION 3 GENERATES BUG HERE
1189 FExperiment.Clean; 1197 FExperiment.Clean;
1190 end; 1198 end;
1191 1199
@@ -1223,7 +1231,6 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1223,7 +1231,6 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1223 // return to experiment and present the prompt consequence, if any 1231 // return to experiment and present the prompt consequence, if any
1224 if FExperiment.Condition[FExperiment.CurrentCondition].Prompt.ResponsesCount = FExperiment.PlayersCount then 1232 if FExperiment.Condition[FExperiment.CurrentCondition].Prompt.ResponsesCount = FExperiment.PlayersCount then
1225 begin 1233 begin
1226 -  
1227 // generate messages 1234 // generate messages
1228 LPromptConsequences := FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AsString; 1235 LPromptConsequences := FExperiment.Condition[FExperiment.CurrentCondition].Prompt.AsString;
1229 SetLength(M, 3+LPromptConsequences.Count); 1236 SetLength(M, 3+LPromptConsequences.Count);
@@ -1243,7 +1250,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1243,7 +1250,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1243 end 1250 end
1244 else; 1251 else;
1245 1252
1246 - // send identified messages; each player takes only its own message and ignore the rest 1253 + // send identified messages; each player takes only its own message and ignore the rest
1247 FZMQActor.SendMessage(M); 1254 FZMQActor.SendMessage(M);
1248 FExperiment.WriteReportRowPrompt; 1255 FExperiment.WriteReportRowPrompt;
1249 FExperiment.Clean; 1256 FExperiment.Clean;
@@ -1263,7 +1270,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList); @@ -1263,7 +1270,7 @@ procedure TGameControl.ReceiveRequest(var ARequest: TStringList);
1263 P.Nicname := InputBox 1270 P.Nicname := InputBox
1264 ( 1271 (
1265 'Mudança de geração', 1272 'Mudança de geração',
1266 - 'Um novo participante entrou no lugar do participante mais antigo.Qual o apelido do novo participante?', 1273 + 'Um novo participante entrou no lugar do participante mais antigo. Qual o apelido do novo participante?',
1267 GenResourceName(-1) 1274 GenResourceName(-1)
1268 ); 1275 );
1269 1276
@@ -1312,9 +1319,15 @@ procedure TGameControl.ReceiveReply(AReply: TStringList); @@ -1312,9 +1319,15 @@ procedure TGameControl.ReceiveReply(AReply: TStringList);
1312 // set matrix type/ stringgrid 1319 // set matrix type/ stringgrid
1313 FExperiment.MatrixTypeAsString:=AReply[AReply.Count-4]; 1320 FExperiment.MatrixTypeAsString:=AReply[AReply.Count-4];
1314 1321
1315 - // add chat  
1316 - FormMatrixGame.ChatMemoRecv.Lines.Clear;  
1317 - FormMatrixGame.ChatMemoRecv.Lines.Add(AReply[AReply.Count-3]); 1322 + // enable chat
  1323 + if AReply[AReply.Count-3] = '[NOCHAT]' then
  1324 + FormMatrixGame.ChatPanel.Visible := False
  1325 + else
  1326 + begin
  1327 + FormMatrixGame.ChatPanel.Visible := True;
  1328 + FormMatrixGame.ChatMemoRecv.Lines.Clear;
  1329 + FormMatrixGame.ChatMemoRecv.Lines.Append(AReply[AReply.Count-3]);
  1330 + end;
1318 1331
1319 // set global configs 1332 // set global configs
1320 FExperiment.ABPoints := StrToBool(AReply[AReply.Count-2]); 1333 FExperiment.ABPoints := StrToBool(AReply[AReply.Count-2]);
@@ -1322,7 +1335,10 @@ procedure TGameControl.ReceiveReply(AReply: TStringList); @@ -1322,7 +1335,10 @@ procedure TGameControl.ReceiveReply(AReply: TStringList);
1322 FormMatrixGame.GBIndividual.Visible:= not FormMatrixGame.GBIndividualAB.Visible; 1335 FormMatrixGame.GBIndividual.Visible:= not FormMatrixGame.GBIndividualAB.Visible;
1323 1336
1324 // set condition specific configurations 1337 // set condition specific configurations
1325 - NextConditionSetup(AReply[AReply.Count-1]) 1338 + NextConditionSetup(AReply[AReply.Count-1]);
  1339 +
  1340 + // set fullscreen
  1341 + FormMatrixGame.SetFullscreen;
1326 end 1342 end
1327 else 1343 else
1328 begin 1344 begin
experiment_runner/units/game_experiment.pas
@@ -143,6 +143,7 @@ type @@ -143,6 +143,7 @@ type
143 function AppendContingency(ACondition : integer;AContingency : TContingency) : integer;overload; 143 function AppendContingency(ACondition : integer;AContingency : TContingency) : integer;overload;
144 function AppendPlayer : integer;overload; 144 function AppendPlayer : integer;overload;
145 function AppendPlayer(APlayer : TPlayer) : integer; overload; 145 function AppendPlayer(APlayer : TPlayer) : integer; overload;
  146 + function TargetIntelockingFired : Boolean;
146 property Condition[I : Integer]: TCondition read GetCondition write SetCondition; 147 property Condition[I : Integer]: TCondition read GetCondition write SetCondition;
147 property ConditionsCount : integer read GetConditionsCount; 148 property ConditionsCount : integer read GetConditionsCount;
148 property CurrentCondition : integer read FCurrentCondition write FCurrentCondition; 149 property CurrentCondition : integer read FCurrentCondition write FCurrentCondition;
@@ -300,8 +301,19 @@ end; @@ -300,8 +301,19 @@ end;
300 function TExperiment.GetPlayer(AID: UTF8string): TPlayer; 301 function TExperiment.GetPlayer(AID: UTF8string): TPlayer;
301 var 302 var
302 i : integer; 303 i : integer;
303 -begin  
304 - //Result.ID := ''; 304 + P : TPlayer = (
  305 + ID : '';
  306 + Nicname : '';
  307 + Login: '';
  308 + Password: '';
  309 + Status : gpsWaiting;
  310 + Data : nil;
  311 + Choice : (Row:grNone; Color:gcNone);
  312 + Points : (A:0; B:0);
  313 + Turn : -1;
  314 + );
  315 +begin
  316 + Result := P;
305 if PlayersCount > 0 then 317 if PlayersCount > 0 then
306 for i:= 0 to PlayersCount -1 do 318 for i:= 0 to PlayersCount -1 do
307 if FPlayers[i].ID = AID then 319 if FPlayers[i].ID = AID then
@@ -746,7 +758,7 @@ begin @@ -746,7 +758,7 @@ begin
746 LRow += 'NA'+#9; 758 LRow += 'NA'+#9;
747 759
748 FRegData.SaveData(LRow); 760 FRegData.SaveData(LRow);
749 - FReportReader.Extend(LRow); 761 + FReportReader.Extend(LRow); // Write, i.e, extend last row
750 end; 762 end;
751 end; 763 end;
752 764
@@ -886,6 +898,18 @@ begin @@ -886,6 +898,18 @@ begin
886 FPlayers[Result] := APlayer; 898 FPlayers[Result] := APlayer;
887 end; 899 end;
888 900
  901 +function TExperiment.TargetIntelockingFired: Boolean;
  902 +var i : integer;
  903 +begin
  904 + Result := False;
  905 + for i:= 0 to ContingenciesCount[CurrentCondition]-1 do
  906 + if Condition[CurrentCondition].Contingencies[i].Meta then
  907 + begin
  908 + Result := Condition[CurrentCondition].Contingencies[i].Fired;
  909 + Break;
  910 + end;
  911 +end;
  912 +
889 function TExperiment.ShouldEndCondition: Boolean; 913 function TExperiment.ShouldEndCondition: Boolean;
890 var 914 var
891 LInterlocks: Real; 915 LInterlocks: Real;
@@ -960,7 +984,7 @@ begin @@ -960,7 +984,7 @@ begin
960 for i := 0 to ContingenciesCount[c]-1 do 984 for i := 0 to ContingenciesCount[c]-1 do
961 Contingency[c,i].Clean; 985 Contingency[c,i].Clean;
962 986
963 - if Assigned(Condition[c].Prompt) then 987 + if Assigned(Condition[c].Prompt) then // TODO: FIND WHY OPTIMIZATION 3 GENERATES BUG HERE
964 Condition[c].Prompt.Clean; 988 Condition[c].Prompt.Clean;
965 989
966 FRegData.CloseAndOpen; 990 FRegData.CloseAndOpen;
experiment_runner/units/game_file_methods.pas
@@ -35,6 +35,7 @@ implementation @@ -35,6 +35,7 @@ implementation
35 35
36 uses LCLIntf, game_resources, game_actors, game_actors_helpers, string_methods, regdata; 36 uses LCLIntf, game_resources, game_actors, game_actors_helpers, string_methods, regdata;
37 37
  38 +// for dev only
38 function LoadExperimentFromResource(var AExperiment: TExperiment): Boolean; 39 function LoadExperimentFromResource(var AExperiment: TExperiment): Boolean;
39 var 40 var
40 C : TCondition; 41 C : TCondition;
@@ -68,6 +69,7 @@ begin @@ -68,6 +69,7 @@ begin
68 begin 69 begin
69 ExperimentName:='test_experiment'; 70 ExperimentName:='test_experiment';
70 ExperimentAim:='This is a test experiment.'; 71 ExperimentAim:='This is a test experiment.';
  72 + ShowChat := True;
71 Researcher := VAL_RESEARCHER; 73 Researcher := VAL_RESEARCHER;
72 ResearcherCanPlay:=False; 74 ResearcherCanPlay:=False;
73 ResearcherCanChat:=True; 75 ResearcherCanChat:=True;
@@ -169,6 +171,7 @@ var @@ -169,6 +171,7 @@ var
169 AExperiment.ExperimentAim:=ReadString(SEC_EXPERIMENT, KEY_AIM,''); 171 AExperiment.ExperimentAim:=ReadString(SEC_EXPERIMENT, KEY_AIM,'');
170 172
171 // general configs 173 // general configs
  174 + AExperiment.ShowChat := ReadBool(SEC_EXPERIMENT, KEY_CHAT_FOR_PLAYERS, False);
172 AExperiment.ResearcherCanPlay := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY,False); 175 AExperiment.ResearcherCanPlay := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY,False);
173 AExperiment.ResearcherCanChat := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT,False); 176 AExperiment.ResearcherCanChat := ReadBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT,False);
174 AExperiment.GenPlayersAsNeeded := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED,False); 177 AExperiment.GenPlayersAsNeeded := ReadBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED,False);
@@ -177,7 +180,7 @@ var @@ -177,7 +180,7 @@ var
177 AExperiment.MatrixType := GetMatrixTypeFromString(ReadString(SEC_EXPERIMENT,KEY_MATRIX_TYPE,DEF_MATRIX_TYPE)); 180 AExperiment.MatrixType := GetMatrixTypeFromString(ReadString(SEC_EXPERIMENT,KEY_MATRIX_TYPE,DEF_MATRIX_TYPE));
178 181
179 // used when loading from paused experiments 182 // used when loading from paused experiments
180 - AExperiment.CurrentCondition := ReadInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION,0)-1; //zero based 183 + AExperiment.CurrentCondition := ReadInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION,0); //zero based
181 end; 184 end;
182 end; 185 end;
183 186
@@ -256,7 +259,7 @@ var @@ -256,7 +259,7 @@ var
256 Turn.Random:= ReadBool(LS, KEY_TURN_RANDOM,False); 259 Turn.Random:= ReadBool(LS, KEY_TURN_RANDOM,False);
257 Cycles.Count:= ReadInteger(LS, KEY_CYCLES_COUNT,0); 260 Cycles.Count:= ReadInteger(LS, KEY_CYCLES_COUNT,0);
258 Cycles.Value:= ReadInteger(LS, KEY_CYCLES_VALUE,10); 261 Cycles.Value:= ReadInteger(LS, KEY_CYCLES_VALUE,10);
259 - Cycles.Generation:= ReadInteger(LS, KEY_CYCLES_GEN,5); 262 + Cycles.Generation:= ReadInteger(LS, KEY_CYCLES_GEN,0);
260 EndCriterium.Style := GetEndCriteriaStyleFromString(ReadString(LS,KEY_ENDCRITERIA,DEF_END_CRITERIA_STYLE)); 263 EndCriterium.Style := GetEndCriteriaStyleFromString(ReadString(LS,KEY_ENDCRITERIA,DEF_END_CRITERIA_STYLE));
261 EndCriterium.AbsoluteCycles:=ReadInteger(LS,KEY_ENDCRITERIA_CYCLES,20); 264 EndCriterium.AbsoluteCycles:=ReadInteger(LS,KEY_ENDCRITERIA_CYCLES,20);
262 s1 := ReadString(LS,KEY_ENDCRITERIA_PORCENTAGE,DEF_END_CRITERIA_PORCENTAGE); 265 s1 := ReadString(LS,KEY_ENDCRITERIA_PORCENTAGE,DEF_END_CRITERIA_PORCENTAGE);
@@ -383,9 +386,23 @@ begin @@ -383,9 +386,23 @@ begin
383 LIniFile:= TIniFile.Create(LWriter.FileName); 386 LIniFile:= TIniFile.Create(LWriter.FileName);
384 LWriter.Free; 387 LWriter.Free;
385 388
386 - LIniFile.WriteString(SEC_EXPERIMENT,KEY_RESEARCHER,AExperiment.Researcher);  
387 - 389 + // write experiment
388 with LIniFile do 390 with LIniFile do
  391 + begin
  392 + WriteString(SEC_EXPERIMENT, KEY_RESEARCHER, AExperiment.Researcher);
  393 + WriteString(SEC_EXPERIMENT, KEY_NAME, AExperiment.ExperimentName);
  394 + WriteString(SEC_EXPERIMENT, KEY_AIM, AExperiment.ExperimentAim);
  395 + WriteBool(SEC_EXPERIMENT, KEY_CHAT_FOR_PLAYERS, AExperiment.ShowChat);
  396 + WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANPLAY, AExperiment.ResearcherCanPlay);
  397 + WriteBool(SEC_EXPERIMENT, KEY_RESEARCHER_CANCHAT, AExperiment.ResearcherCanChat);
  398 + WriteBool(SEC_EXPERIMENT, KEY_GEN_PLAYER_AS_NEEDED, AExperiment.GenPlayersAsNeeded);
  399 + WriteBool(SEC_EXPERIMENT, KEY_CHAT_HISTORY_FOR_NEW_PLAYERS, AExperiment.SendChatHistoryForNewPlayers);
  400 + WriteBool(SEC_EXPERIMENT, KEY_POINTS_TYPE, AExperiment.ABPoints);
  401 + WriteString(SEC_EXPERIMENT,KEY_MATRIX_TYPE,GetMatrixTypeString(AExperiment.MatrixType));
  402 + WriteInteger(SEC_EXPERIMENT, KEY_CURRENT_CONDITION, AExperiment.CurrentCondition);
  403 + end;
  404 +
  405 + with LIniFile do // write conditions
389 for i := 0 to AExperiment.ConditionsCount-1 do 406 for i := 0 to AExperiment.ConditionsCount-1 do
390 begin 407 begin
391 LC := SEC_CONDITION+IntToStr(i+1); 408 LC := SEC_CONDITION+IntToStr(i+1);
@@ -415,7 +432,7 @@ begin @@ -415,7 +432,7 @@ begin
415 432
416 MI := 0; 433 MI := 0;
417 CI := 0; 434 CI := 0;
418 - for j := 0 to High(Contingencies) do 435 + for j := 0 to High(Contingencies) do // write ocntingencies
419 begin 436 begin
420 if Contingencies[j].Meta then 437 if Contingencies[j].Meta then
421 begin 438 begin
experiment_runner/units/game_resources.pas
@@ -28,6 +28,7 @@ resourcestring @@ -28,6 +28,7 @@ resourcestring
28 KEY_RESEARCHER_CANCHAT = 'Pesquisador.BatePapo'; 28 KEY_RESEARCHER_CANCHAT = 'Pesquisador.BatePapo';
29 KEY_RESEARCHER_CANPLAY = 'Pesquisador.PodeJogar'; 29 KEY_RESEARCHER_CANPLAY = 'Pesquisador.PodeJogar';
30 KEY_GEN_PLAYER_AS_NEEDED = 'Jogadores.GerarAutomaticamente'; 30 KEY_GEN_PLAYER_AS_NEEDED = 'Jogadores.GerarAutomaticamente';
  31 + KEY_CHAT_FOR_PLAYERS = 'Jogadores.BatePapo';
31 KEY_CHAT_HISTORY_FOR_NEW_PLAYERS = 'Jogadores.Novos.Enviar_Histórico_do_BatePapo'; 32 KEY_CHAT_HISTORY_FOR_NEW_PLAYERS = 'Jogadores.Novos.Enviar_Histórico_do_BatePapo';
32 KEY_CURRENT_CONDITION = 'ComeçarNaCondição'; 33 KEY_CURRENT_CONDITION = 'ComeçarNaCondição';
33 KEY_MATRIX_TYPE= 'TipoDaMatrix'; 34 KEY_MATRIX_TYPE= 'TipoDaMatrix';