Pārlūkot izejas kodu

all tests Passing

Kibret Tecle 6 gadus atpakaļ
vecāks
revīzija
dc72023b4e

+ 143
- 125
.idea/workspace.xml Parādīt failu

@@ -2,8 +2,8 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="e282cee1-bfe9-42a3-9794-9633eb4654d1" name="Default" comment="">
5
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
6 5
       <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
6
+      <change beforePath="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" afterPath="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
7 7
     </list>
8 8
     <ignored path="$PROJECT_DIR$/target/" />
9 9
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -13,53 +13,61 @@
13 13
     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
14 14
     <option name="LAST_RESOLUTION" value="IGNORE" />
15 15
   </component>
16
+  <component name="CoverageDataManager">
17
+    <SUITE FILE_PATH="coverage/ConwayGameOfLife$ConwayGameOfLifeTest_runTest1.coverage" NAME="ConwayGameOfLifeTest.runTest1 Coverage Results" MODIFIED="1520897845735" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="idea" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false">
18
+      <FILTER>com.zipcodeconway.*</FILTER>
19
+    </SUITE>
20
+  </component>
16 21
   <component name="FileEditorManager">
17
-    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
18
-      <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="false">
19
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
20
-          <provider selected="true" editor-type-id="text-editor">
21
-            <state relative-caret-position="255">
22
-              <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
23
-              <folding>
24
-                <element signature="imports" expanded="true" />
25
-              </folding>
26
-            </state>
27
-          </provider>
28
-        </entry>
29
-      </file>
30
-      <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
31
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
32
-          <provider selected="true" editor-type-id="text-editor">
33
-            <state relative-caret-position="214">
34
-              <caret line="68" column="4" lean-forward="false" selection-start-line="68" selection-start-column="4" selection-end-line="68" selection-end-column="4" />
35
-              <folding>
36
-                <element signature="e#269#270#0" expanded="true" />
37
-                <element signature="e#334#335#0" expanded="true" />
38
-                <element signature="e#1252#1253#0" expanded="true" />
39
-                <element signature="e#1288#1289#0" expanded="true" />
40
-              </folding>
41
-            </state>
42
-          </provider>
43
-        </entry>
44
-      </file>
45
-      <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="false">
46
-        <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
47
-          <provider selected="true" editor-type-id="text-editor">
48
-            <state relative-caret-position="450">
49
-              <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
50
-              <folding />
51
-            </state>
52
-          </provider>
53
-        </entry>
54
-      </file>
55
-      <file leaf-file-name="ConwayLifeRandomat50.png" pinned="false" current-in-tab="false">
56
-        <entry file="file://$PROJECT_DIR$/ConwayLifeRandomat50.png">
57
-          <provider selected="true" editor-type-id="images">
58
-            <state />
59
-          </provider>
60
-        </entry>
61
-      </file>
62
-    </leaf>
22
+    <splitter split-orientation="horizontal" split-proportion="0.52879584">
23
+      <split-first>
24
+        <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
25
+          <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="false">
26
+            <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
27
+              <provider selected="true" editor-type-id="text-editor">
28
+                <state relative-caret-position="255">
29
+                  <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
30
+                  <folding>
31
+                    <element signature="imports" expanded="true" />
32
+                  </folding>
33
+                </state>
34
+              </provider>
35
+            </entry>
36
+          </file>
37
+          <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
38
+            <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
39
+              <provider selected="true" editor-type-id="text-editor">
40
+                <state relative-caret-position="759">
41
+                  <caret line="55" column="9" lean-forward="true" selection-start-line="55" selection-start-column="9" selection-end-line="55" selection-end-column="9" />
42
+                  <folding />
43
+                </state>
44
+              </provider>
45
+            </entry>
46
+          </file>
47
+          <file leaf-file-name="ConwayLifeRandomat50.png" pinned="false" current-in-tab="false">
48
+            <entry file="file://$PROJECT_DIR$/ConwayLifeRandomat50.png">
49
+              <provider selected="true" editor-type-id="images">
50
+                <state />
51
+              </provider>
52
+            </entry>
53
+          </file>
54
+        </leaf>
55
+      </split-first>
56
+      <split-second>
57
+        <leaf>
58
+          <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
59
+            <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
60
+              <provider selected="true" editor-type-id="text-editor">
61
+                <state relative-caret-position="855">
62
+                  <caret line="60" column="0" lean-forward="false" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
63
+                  <folding />
64
+                </state>
65
+              </provider>
66
+            </entry>
67
+          </file>
68
+        </leaf>
69
+      </split-second>
70
+    </splitter>
63 71
   </component>
64 72
   <component name="FileTemplateManagerImpl">
65 73
     <option name="RECENT_TEMPLATES">
@@ -98,9 +106,9 @@
98 106
         <option value="$PROJECT_DIR$/src/main/java/SimpleWindow.java" />
99 107
         <option value="$PROJECT_DIR$/src/main/java/ConwayGameOfLife.java" />
100 108
         <option value="$PROJECT_DIR$/src/main/java/Life.java" />
101
-        <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
102 109
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
103 110
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
111
+        <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
104 112
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
105 113
       </list>
106 114
     </option>
@@ -111,7 +119,7 @@
111 119
     <detection-done>true</detection-done>
112 120
     <sorting>DEFINITION_ORDER</sorting>
113 121
   </component>
114
-  <component name="ProjectFrameBounds" extendedState="1">
122
+  <component name="ProjectFrameBounds">
115 123
     <option name="y" value="23" />
116 124
     <option name="width" value="1440" />
117 125
     <option name="height" value="793" />
@@ -259,20 +267,6 @@
259 267
       <module name="Game-Of-Life-Java" />
260 268
       <envs />
261 269
     </configuration>
262
-    <configuration name="GameofLife" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
263
-      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
264
-      <option name="MAIN_CLASS_NAME" value="GameofLife" />
265
-      <option name="VM_PARAMETERS" />
266
-      <option name="PROGRAM_PARAMETERS" />
267
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
268
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
269
-      <option name="ALTERNATIVE_JRE_PATH" />
270
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
271
-      <option name="ENV_VARIABLES" />
272
-      <option name="PASS_PARENT_ENVS" value="true" />
273
-      <module name="Game-Of-Life-Java" />
274
-      <envs />
275
-    </configuration>
276 270
     <configuration default="true" type="Application" factoryName="Application">
277 271
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
278 272
       <option name="MAIN_CLASS_NAME" />
@@ -312,7 +306,7 @@
312 306
       <envs />
313 307
       <patterns />
314 308
     </configuration>
315
-    <configuration name="ConwayGameOfLifeTest.runTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
309
+    <configuration name="ConwayGameOfLifeTest.runTest1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
316 310
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
317 311
         <pattern>
318 312
           <option name="PATTERN" value="com.zipcodeconway.*" />
@@ -324,7 +318,7 @@
324 318
       <option name="ALTERNATIVE_JRE_PATH" />
325 319
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
326 320
       <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
327
-      <option name="METHOD_NAME" value="runTest" />
321
+      <option name="METHOD_NAME" value="runTest1" />
328 322
       <option name="TEST_OBJECT" value="method" />
329 323
       <option name="VM_PARAMETERS" value="-ea" />
330 324
       <option name="PARAMETERS" />
@@ -337,7 +331,7 @@
337 331
       <envs />
338 332
       <patterns />
339 333
     </configuration>
340
-    <configuration name="ConwayGameOfLifeTest.runTest2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
334
+    <configuration name="ConwayGameOfLifeTest.runTest3" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
341 335
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
342 336
         <pattern>
343 337
           <option name="PATTERN" value="com.zipcodeconway.*" />
@@ -349,7 +343,32 @@
349 343
       <option name="ALTERNATIVE_JRE_PATH" />
350 344
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
351 345
       <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
352
-      <option name="METHOD_NAME" value="runTest2" />
346
+      <option name="METHOD_NAME" value="runTest3" />
347
+      <option name="TEST_OBJECT" value="method" />
348
+      <option name="VM_PARAMETERS" value="-ea" />
349
+      <option name="PARAMETERS" />
350
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
351
+      <option name="ENV_VARIABLES" />
352
+      <option name="PASS_PARENT_ENVS" value="true" />
353
+      <option name="TEST_SEARCH_SCOPE">
354
+        <value defaultName="singleModule" />
355
+      </option>
356
+      <envs />
357
+      <patterns />
358
+    </configuration>
359
+    <configuration name="ConwayGameOfLifeTest.testIsAlive2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
360
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
361
+        <pattern>
362
+          <option name="PATTERN" value="com.zipcodeconway.*" />
363
+          <option name="ENABLED" value="true" />
364
+        </pattern>
365
+      </extension>
366
+      <module name="Game-Of-Life-Java" />
367
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
368
+      <option name="ALTERNATIVE_JRE_PATH" />
369
+      <option name="PACKAGE_NAME" value="com.zipcodeconway" />
370
+      <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
371
+      <option name="METHOD_NAME" value="testIsAlive2" />
353 372
       <option name="TEST_OBJECT" value="method" />
354 373
       <option name="VM_PARAMETERS" value="-ea" />
355 374
       <option name="PARAMETERS" />
@@ -445,19 +464,19 @@
445 464
     </configuration>
446 465
     <list size="6">
447 466
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
448
-      <item index="1" class="java.lang.String" itemvalue="Application.GameofLife" />
449
-      <item index="2" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
450
-      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
451
-      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
452
-      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
467
+      <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testIsAlive2" />
468
+      <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
469
+      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
470
+      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
471
+      <item index="5" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
453 472
     </list>
454 473
     <recent_temporary>
455 474
       <list size="5">
456 475
         <item index="0" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
457 476
         <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
458
-        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
459
-        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
460
-        <item index="4" class="java.lang.String" itemvalue="Application.GameofLife" />
477
+        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
478
+        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
479
+        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testIsAlive2" />
461 480
       </list>
462 481
     </recent_temporary>
463 482
   </component>
@@ -475,69 +494,70 @@
475 494
       <option name="presentableId" value="Default" />
476 495
       <updated>1519668901598</updated>
477 496
       <workItem from="1519668902904" duration="14517000" />
478
-      <workItem from="1520801916382" duration="6653000" />
497
+      <workItem from="1520801916382" duration="33053000" />
479 498
     </task>
480 499
     <servers />
481 500
   </component>
482 501
   <component name="TestHistory">
483
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 03m 01s.xml">
502
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 19h 41m 47s.xml">
484 503
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
485 504
     </history-entry>
486
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 05m 07s.xml">
505
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 19h 43m 58s.xml">
487 506
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
488 507
     </history-entry>
489
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 06m 11s.xml">
508
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 20h 24m 50s.xml">
490 509
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
491 510
     </history-entry>
492
-    <history-entry file="ConwayGameOfLifeTest - 2018.03.11 at 16h 59m 05s.xml">
493
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
511
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 37m 26s.xml">
512
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
494 513
     </history-entry>
495
-    <history-entry file="ConwayGameOfLifeTest - 2018.03.11 at 17h 23m 11s.xml">
496
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
514
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 39m 16s.xml">
515
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
497 516
     </history-entry>
498
-    <history-entry file="ConwayGameOfLifeTest - 2018.03.11 at 17h 25m 50s.xml">
499
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
517
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 39m 37s.xml">
518
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
500 519
     </history-entry>
501
-    <history-entry file="ConwayGameOfLifeTest - 2018.03.11 at 17h 26m 15s.xml">
502
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
520
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 39m 39s.xml">
521
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
503 522
     </history-entry>
504
-    <history-entry file="ConwayGameOfLifeTest_runTest - 2018.02.26 at 15h 41m 14s.xml">
505
-      <configuration name="ConwayGameOfLifeTest.runTest" configurationId="JUnit" />
523
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 39m 46s.xml">
524
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
506 525
     </history-entry>
507
-    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.02.26 at 15h 42m 02s.xml">
508
-      <configuration name="ConwayGameOfLifeTest.runTest2" configurationId="JUnit" />
526
+    <history-entry file="ConwayGameOfLifeTest_runTest3 - 2018.03.12 at 19h 42m 29s.xml">
527
+      <configuration name="ConwayGameOfLifeTest.runTest3" configurationId="JUnit" />
509 528
     </history-entry>
510
-    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.02.26 at 15h 42m 18s.xml">
511
-      <configuration name="ConwayGameOfLifeTest.runTest2" configurationId="JUnit" />
529
+    <history-entry file="ConwayGameOfLifeTest_runTest3 - 2018.03.12 at 19h 42m 39s.xml">
530
+      <configuration name="ConwayGameOfLifeTest.runTest3" configurationId="JUnit" />
512 531
     </history-entry>
513 532
   </component>
514 533
   <component name="TimeTrackingManager">
515
-    <option name="totallyTimeSpent" value="21170000" />
534
+    <option name="totallyTimeSpent" value="47570000" />
516 535
   </component>
517 536
   <component name="ToolWindowManager">
518
-    <frame x="0" y="23" width="1440" height="793" extended-state="1" />
537
+    <frame x="0" y="23" width="1440" height="793" extended-state="0" />
519 538
     <editor active="true" />
520 539
     <layout>
521 540
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
522 541
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
523
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32833788" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
542
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32808024" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
524 543
       <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
525 544
       <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
526 545
       <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
527 546
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
528 547
       <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
529
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.46848136" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
548
+      <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.11318052" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
530 549
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
531
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32970026" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
550
+      <window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297568" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
551
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2284012" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
532 552
       <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
533 553
       <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
534
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2532189" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
554
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18025751" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
535 555
       <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
536 556
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
537 557
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
538 558
       <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
539 559
       <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
540
-      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
560
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3982808" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
541 561
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
542 562
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
543 563
       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@@ -555,7 +575,7 @@
555 575
   </component>
556 576
   <component name="XDebuggerManager">
557 577
     <breakpoint-manager>
558
-      <option name="time" value="2" />
578
+      <option name="time" value="25" />
559 579
     </breakpoint-manager>
560 580
     <watches-manager />
561 581
   </component>
@@ -574,12 +594,7 @@
574 594
       <provider selected="true" editor-type-id="text-editor">
575 595
         <state relative-caret-position="300">
576 596
           <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
577
-          <folding>
578
-            <element signature="e#269#270#0" expanded="true" />
579
-            <element signature="e#334#335#0" expanded="true" />
580
-            <element signature="e#1252#1253#0" expanded="true" />
581
-            <element signature="e#1288#1289#0" expanded="true" />
582
-          </folding>
597
+          <folding />
583 598
         </state>
584 599
       </provider>
585 600
     </entry>
@@ -626,11 +641,13 @@
626 641
     <entry file="file://$USER_HOME$/Downloads/ConwayLifeRandomat50.png" />
627 642
     <entry file="file://$USER_HOME$/Documents/gitea/gitea/custom/public/img/ConwayLifeUML.png" />
628 643
     <entry file="file://$PROJECT_DIR$/src/main/java/GameofLife.java" />
629
-    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
644
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
630 645
       <provider selected="true" editor-type-id="text-editor">
631
-        <state relative-caret-position="450">
632
-          <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
633
-          <folding />
646
+        <state relative-caret-position="255">
647
+          <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
648
+          <folding>
649
+            <element signature="imports" expanded="true" />
650
+          </folding>
634 651
         </state>
635 652
       </provider>
636 653
     </entry>
@@ -639,26 +656,27 @@
639 656
         <state />
640 657
       </provider>
641 658
     </entry>
642
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
659
+    <entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/rt.jar!/sun/reflect/NativeMethodAccessorImpl.class">
643 660
       <provider selected="true" editor-type-id="text-editor">
644
-        <state relative-caret-position="255">
645
-          <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
646
-          <folding>
647
-            <element signature="imports" expanded="true" />
648
-          </folding>
661
+        <state relative-caret-position="313">
662
+          <caret line="33" column="33" lean-forward="false" selection-start-line="33" selection-start-column="33" selection-end-line="33" selection-end-column="33" />
663
+          <folding />
664
+        </state>
665
+      </provider>
666
+    </entry>
667
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
668
+      <provider selected="true" editor-type-id="text-editor">
669
+        <state relative-caret-position="855">
670
+          <caret line="60" column="0" lean-forward="false" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
671
+          <folding />
649 672
         </state>
650 673
       </provider>
651 674
     </entry>
652 675
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
653 676
       <provider selected="true" editor-type-id="text-editor">
654
-        <state relative-caret-position="214">
655
-          <caret line="68" column="4" lean-forward="false" selection-start-line="68" selection-start-column="4" selection-end-line="68" selection-end-column="4" />
656
-          <folding>
657
-            <element signature="e#269#270#0" expanded="true" />
658
-            <element signature="e#334#335#0" expanded="true" />
659
-            <element signature="e#1252#1253#0" expanded="true" />
660
-            <element signature="e#1288#1289#0" expanded="true" />
661
-          </folding>
677
+        <state relative-caret-position="759">
678
+          <caret line="55" column="9" lean-forward="true" selection-start-line="55" selection-start-column="9" selection-end-line="55" selection-end-column="9" />
679
+          <folding />
662 680
         </state>
663 681
       </provider>
664 682
     </entry>

+ 95
- 46
src/main/java/com/zipcodeconway/ConwayGameOfLife.java Parādīt failu

@@ -1,19 +1,26 @@
1 1
 package com.zipcodeconway;
2 2
 
3
+import java.util.Arrays;
4
+
3 5
 public class ConwayGameOfLife {
4 6
     private Integer dimension;
5
-    private int[][] generation;
7
+    private int[][] current;
8
+    //private int[][] next;
6 9
     public int neighbourRow;
7 10
     public int neighbourCol;
8 11
     private SimpleWindow displayWindow;
9 12
 
10 13
     public ConwayGameOfLife(Integer dimension) {
11 14
         this.displayWindow = new SimpleWindow(dimension);
12
-     }
15
+        this.current = createRandomStart(dimension);
16
+        //this.next = new int[dimension][dimension];
17
+    }
13 18
 
14 19
     public ConwayGameOfLife(Integer dimension, int[][] startmatrix) {
15 20
         this.displayWindow = new SimpleWindow(dimension);
16
-        this.generation = startmatrix;
21
+        this.current = startmatrix;
22
+        this.dimension = dimension;
23
+        //this.next = new int[dimension][dimension];
17 24
     }
18 25
 
19 26
     public static void main(String[] args) {
@@ -25,24 +32,50 @@ public class ConwayGameOfLife {
25 32
     // Which cells are alive or dead in generation 0.
26 33
     // allocates and returns the starting matrix of size 'dimension'
27 34
     private int[][] createRandomStart(Integer dimension) {
28
-        int[][]start = new int[dimension][dimension];
29
-        for(int row =0;row<dimension;row++){
30
-            for(int col=0;col<dimension;col++){
35
+        int[][] start = new int[dimension][dimension];
36
+        for (int row = 0; row < dimension; row++) {
37
+            for (int col = 0; col < dimension; col++) {
31 38
                 int val = (int) Math.round(Math.random());
32
-                start[row][col]=val;
39
+                start[row][col] = val;
33 40
             }
34 41
         }
35
-
36 42
         return start;
37 43
     }
38 44
 
39 45
     public int[][] simulate(Integer maxGenerations) {
40
-        return new int[1][1];
46
+        int[][] currentWorld = current;
47
+        int[][] nextWorld = new int[dimension][dimension];
48
+
49
+        for (int i = 0; i <= maxGenerations; i++) {
50
+            this.displayWindow.display(currentWorld, i);
51
+
52
+
53
+            nextWorld = runSim(currentWorld, nextWorld); // tested!!!
54
+
55
+            currentWorld = copyAndZeroOut(nextWorld, currentWorld);
56
+        }
57
+        this.displayWindow.sleep(125);
58
+        //displayWindow.sleep(10000);
59
+        return currentWorld;
60
+    }
61
+
62
+    private int[][] runSim(int[][] currentWorld, int[][] nextWorld) {
63
+        for (int row = 0; row < currentWorld.length; row++) {
64
+            for (int col = 0; col < currentWorld[row].length; col++) {
65
+                nextWorld[row][col] = isAlive(row, col, currentWorld);
66
+            }
67
+        }
68
+        return nextWorld;
41 69
     }
42 70
 
43 71
     // copy the values of 'next' matrix to 'current' matrix,
44 72
     // and then zero out the contents of 'next' matrix
45
-    public void copyAndZeroOut(int [][] next, int[][] current) {
73
+    public int[][] copyAndZeroOut(int[][] nextWorld, int[][] currentWorld) {
74
+        for (int i = 0; i < currentWorld.length; i++) {
75
+            System.arraycopy(nextWorld[i], 0, currentWorld[i], 0, currentWorld.length);
76
+            Arrays.fill(nextWorld[i], 0);
77
+        }
78
+        return currentWorld;
46 79
     }
47 80
 
48 81
     // Calculate if an individual cell should be alive in the next generation.
@@ -53,52 +86,68 @@ public class ConwayGameOfLife {
53 86
 		Any live cell with two or three live neighbours lives, unchanged, to the next generation.
54 87
 		Any dead cell with exactly three live neighbours cells will come to life.
55 88
 	*/
56
-    private int isAlive(int row, int col, int[][] world) {
57
-        int[]neighbours = getNeignbours(row,col,world);
58
-        if(world[row][col]==1 && getNumberOfLiveNeighbours(neighbours)<2){ world[row][col]=0; }
59
-        else if(world[row][col]==1 && getNumberOfLiveNeighbours(neighbours)>3){world[row][col]=0; }
60
-        else if(world[row][col]==1 && (getNumberOfLiveNeighbours(neighbours)==3)||(getNumberOfLiveNeighbours(neighbours)==2)){world[row][col]=1; }
61
-        else if (world[row][col]==0&& getNumberOfLiveNeighbours(neighbours)==3){world[row][col]=1}
89
+    public int isAlive(int row, int col, int[][] world) {
90
+        int neighbours = getNeighbours(row, col, world);
62 91
 
92
+        //test
93
+        if (neighbours == 2)
94
+            return world[row][col];
95
+        else if (neighbours == 3)
96
+            return 1;
97
+        else
98
+            return 0;
99
+        //
100
+
101
+//        if (world[row][col] == 1 && (neighbours < 2)) {
102
+//            return 0;
103
+//        } else if (world[row][col] == 1 && (neighbours > 3)) {
104
+//             return 0;
105
+//        } else if (world[row][col] == 1 && (neighbours == 3) ||
106
+//                (neighbours == 2)) {
107
+//            return 1;
108
+//        } else if (world[row][col] == 0 && (neighbours == 3)) {
109
+//            return 1;
110
+//        }
63 111
 
64
-        return world[row][col];
65
-    }
66
-    public int[] getNeignbours(int row, int col,int[][]input){
67
-        int[] neignbours = new int[8];
68
-        for(int i=0;i<8;i++){
69
-            checkBoundries(row,col,input);
70
-            neignbours[i]=input[neighbourRow][neighbourCol];
71
-        }
72
-        return neignbours;
73 112
     }
74
-    public int getNumberOfLiveNeighbours(int[]neighbours){
75
-        int count=0;
76
-        for(int i=0;i<neighbours.length;i++){
77
-            count+=neighbours[i];
113
+
114
+    public int getNeighbours(int row, int col, int[][] input) {
115
+        int totalNeighbors = 0;
116
+        int index = 0;
117
+        for (int i = -1; i <= 1; i++) {
118
+            for (int j = -1; j <= 1; j++) {
119
+                int neighbourRow = getNeighbourRow(i, row, input);
120
+                int neighbourCol = getNeighbourCol(j, col, input);
121
+                if (!(getNeighbourRow(i, row, input) == row && getNeighbourCol(j, col, input) == col)) {
122
+                    totalNeighbors += input[neighbourRow][neighbourCol];
123
+                    index++;
124
+                }
125
+            }
78 126
         }
79
-        return count;
127
+        return totalNeighbors;
80 128
     }
81
-    public void checkBoundries(int row, int col,int[][]input) {
82
-        if (row - 1 < 0) {
83
-            neighbourRow = input.length;
84
-        } else {
85
-            neighbourRow = row - 1;
86
-        }
87
-        if (row + 1 > input.length) {
129
+
130
+    public int getNeighbourRow(int x, int row, int[][] input) {
131
+        int neighbourRow;
132
+        if (row + x < 0) {
133
+            neighbourRow = input.length - 1;
134
+        } else if (row + x > input.length - 1) {
88 135
             neighbourRow = 0;
89 136
         } else {
90
-            neighbourRow = row + 1;
91
-        }
92
-        if (col - 1 < 0) {
93
-            neighbourCol = input[0].length;
94
-        } else {
95
-            neighbourCol = col - 1;
137
+            neighbourRow = row + x;
96 138
         }
97
-        if (col + 1 > input[0].length) {
139
+        return neighbourRow;
140
+    }
141
+
142
+    public int getNeighbourCol(int x, int col, int[][] input) {
143
+        int neighbourCol;
144
+        if (col + x < 0) {
145
+            neighbourCol = input[0].length - 1;
146
+        } else if (col + x > input[0].length - 1) {
98 147
             neighbourCol = 0;
99 148
         } else {
100
-            neighbourCol = col + 1;
149
+            neighbourCol = col + x;
101 150
         }
151
+        return neighbourCol;
102 152
     }
103
-
104 153
 }

+ 54
- 0
src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java Parādīt failu

@@ -1,10 +1,63 @@
1 1
 package com.zipcodeconway;
2 2
 
3
+import org.junit.Assert;
3 4
 import org.junit.Test;
4 5
 
5 6
 import static org.junit.Assert.*;
6 7
 
7 8
 public class ConwayGameOfLifeTest {
9
+    @Test
10
+    public void testIsAlive1(){
11
+        ConwayGameOfLife x=new ConwayGameOfLife(5);
12
+        int[][] start = {
13
+                {0, 0, 0, 0, 0},
14
+                {0, 0, 1, 0, 0},
15
+                {0, 0, 1, 0, 0},
16
+                {0, 0, 1, 0, 0},
17
+                {0, 0, 0, 0, 0}};
18
+        int expected =1;
19
+        int actual = x.isAlive(2,1,start);
20
+        Assert.assertEquals(expected,actual);
21
+    }
22
+    @Test
23
+    public void testIsAlive2(){
24
+        ConwayGameOfLife x=new ConwayGameOfLife(5);
25
+        int[][] start = {
26
+                {0, 0, 0, 0, 0},
27
+                {0, 0, 1, 0, 0},
28
+                {0, 0, 1, 0, 0},
29
+                {0, 0, 1, 0, 0},
30
+                {0, 0, 0, 0, 0}};
31
+        int expected =1;
32
+        int actual = x.isAlive(2,2,start);
33
+        Assert.assertEquals(expected,actual);
34
+    }
35
+    @Test
36
+    public void testNumberOfLiveGetNeignbours(){
37
+        ConwayGameOfLife x=new ConwayGameOfLife(5);
38
+        int[][] start = {
39
+                {0, 0, 0, 0, 0},
40
+                {0, 0, 1, 0, 0},
41
+                {0, 0, 1, 0, 0},
42
+                {0, 0, 1, 0, 0},
43
+                {0, 0, 0, 0, 0}};
44
+        int expected =2;
45
+        //int actual = x.getneighbours(x.getNeighbours(3,3,start));
46
+        //Assert.assertEquals(expected,actual);
47
+    }
48
+    @Test
49
+    public void testGetNeignbours(){
50
+        ConwayGameOfLife x=new ConwayGameOfLife(5);
51
+        int[][] start = {
52
+                {0, 0, 0, 0, 0},
53
+                {0, 0, 1, 0, 0},
54
+                {0, 0, 1, 0, 0},
55
+                {0, 0, 1, 0, 0},
56
+                {0, 0, 0, 0, 0}};
57
+        int expected =1;
58
+        //int actual = x.getNeighbours(1,1,start)[7];
59
+        //Assert.assertEquals(expected,actual);
60
+    }
8 61
 
9 62
     @Test
10 63
     public void runTest1() {
@@ -22,6 +75,7 @@ public class ConwayGameOfLifeTest {
22 75
                 {0, 0, 0, 0, 0}};
23 76
         ConwayGameOfLife sim = new ConwayGameOfLife(5, start);
24 77
         int[][] results = sim.simulate(9);
78
+
25 79
         assertTrue(java.util.Arrays.deepEquals(results, expected));
26 80
     }
27 81