Browse Source

advancing on Conway Game of Life

Luis Romero 6 years ago
parent
commit
0ca8d0bde8

+ 124
- 85
.idea/workspace.xml View File

15
     <option name="LAST_RESOLUTION" value="IGNORE" />
15
     <option name="LAST_RESOLUTION" value="IGNORE" />
16
   </component>
16
   </component>
17
   <component name="FileEditorManager">
17
   <component name="FileEditorManager">
18
-    <splitter split-orientation="horizontal" split-proportion="0.43157893">
18
+    <splitter split-orientation="horizontal" split-proportion="0.3061056">
19
       <split-first>
19
       <split-first>
20
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
20
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
21
           <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
21
           <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
22
             <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
22
             <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
23
               <provider selected="true" editor-type-id="text-editor">
23
               <provider selected="true" editor-type-id="text-editor">
24
-                <state relative-caret-position="663">
25
-                  <caret line="68" column="32" lean-forward="true" selection-start-line="68" selection-start-column="32" selection-end-line="68" selection-end-column="32" />
26
-                  <folding />
24
+                <state relative-caret-position="378">
25
+                  <caret line="66" column="21" lean-forward="true" selection-start-line="66" selection-start-column="21" selection-end-line="66" selection-end-column="21" />
26
+                  <folding>
27
+                    <element signature="imports" expanded="true" />
28
+                  </folding>
27
                 </state>
29
                 </state>
28
               </provider>
30
               </provider>
29
             </entry>
31
             </entry>
36
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
38
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
37
               <provider selected="true" editor-type-id="text-editor">
39
               <provider selected="true" editor-type-id="text-editor">
38
                 <state relative-caret-position="870">
40
                 <state relative-caret-position="870">
39
-                  <caret line="58" column="47" lean-forward="true" selection-start-line="54" selection-start-column="31" selection-end-line="58" selection-end-column="47" />
41
+                  <caret line="58" column="47" lean-forward="false" selection-start-line="54" selection-start-column="31" selection-end-line="58" selection-end-column="47" />
40
                   <folding>
42
                   <folding>
41
                     <element signature="imports" expanded="true" />
43
                     <element signature="imports" expanded="true" />
42
                   </folding>
44
                   </folding>
47
           <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
49
           <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
48
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
50
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
49
               <provider selected="true" editor-type-id="text-editor">
51
               <provider selected="true" editor-type-id="text-editor">
50
-                <state relative-caret-position="-126">
51
-                  <caret line="88" column="29" lean-forward="false" selection-start-line="88" selection-start-column="29" selection-end-line="88" selection-end-column="29" />
52
+                <state relative-caret-position="148">
53
+                  <caret line="76" column="0" lean-forward="true" selection-start-line="76" selection-start-column="0" selection-end-line="76" selection-end-column="0" />
52
                   <folding>
54
                   <folding>
53
                     <element signature="imports" expanded="true" />
55
                     <element signature="imports" expanded="true" />
54
-                    <element signature="e#299#300#0" expanded="true" />
55
-                    <element signature="e#341#342#0" expanded="true" />
56
-                    <element signature="e#1158#1159#0" expanded="true" />
57
-                    <element signature="e#1194#1195#0" expanded="true" />
58
-                    <element signature="e#1991#1992#0" expanded="true" />
59
-                    <element signature="e#2028#2029#0" expanded="true" />
60
-                    <element signature="e#2073#2074#0" expanded="true" />
61
-                    <element signature="e#2113#2114#0" expanded="true" />
62
-                    <element signature="e#2642#2643#0" expanded="true" />
63
-                    <element signature="e#2666#2667#0" expanded="true" />
56
+                    <element signature="e#1432#1433#0" expanded="true" />
57
+                    <element signature="e#1468#1469#0" expanded="true" />
58
+                    <element signature="e#2265#2266#0" expanded="true" />
59
+                    <element signature="e#2302#2303#0" expanded="true" />
60
+                    <element signature="e#2347#2348#0" expanded="true" />
61
+                    <element signature="e#2387#2388#0" expanded="true" />
62
+                    <element signature="e#2916#2917#0" expanded="true" />
63
+                    <element signature="e#2940#2941#0" expanded="true" />
64
                   </folding>
64
                   </folding>
65
                 </state>
65
                 </state>
66
               </provider>
66
               </provider>
121
     <sorting>DEFINITION_ORDER</sorting>
121
     <sorting>DEFINITION_ORDER</sorting>
122
   </component>
122
   </component>
123
   <component name="ProjectFrameBounds">
123
   <component name="ProjectFrameBounds">
124
-    <option name="x" value="-82" />
125
-    <option name="y" value="-1018" />
126
-    <option name="width" value="1658" />
124
+    <option name="x" value="216" />
125
+    <option name="y" value="-1013" />
126
+    <option name="width" value="1447" />
127
     <option name="height" value="985" />
127
     <option name="height" value="985" />
128
   </component>
128
   </component>
129
   <component name="ProjectView">
129
   <component name="ProjectView">
142
     </navigator>
142
     </navigator>
143
     <panes>
143
     <panes>
144
       <pane id="Scratches" />
144
       <pane id="Scratches" />
145
-      <pane id="PackagesPane" />
146
       <pane id="AndroidView" />
145
       <pane id="AndroidView" />
147
       <pane id="ProjectPane">
146
       <pane id="ProjectPane">
148
         <subPane>
147
         <subPane>
203
         </subPane>
202
         </subPane>
204
       </pane>
203
       </pane>
205
       <pane id="Scope" />
204
       <pane id="Scope" />
205
+      <pane id="PackagesPane" />
206
     </panes>
206
     </panes>
207
   </component>
207
   </component>
208
   <component name="PropertiesComponent">
208
   <component name="PropertiesComponent">
242
       </list>
242
       </list>
243
     </option>
243
     </option>
244
   </component>
244
   </component>
245
-  <component name="RunManager" selected="Application.ConwayGameOfLife">
245
+  <component name="RunManager" selected="JUnit.ConwayGameOfLifeTest.copyAndZeroOutTest">
246
     <configuration default="true" type="Applet" factoryName="Applet">
246
     <configuration default="true" type="Applet" factoryName="Applet">
247
       <option name="HTML_USED" value="false" />
247
       <option name="HTML_USED" value="false" />
248
       <option name="WIDTH" value="400" />
248
       <option name="WIDTH" value="400" />
302
       <module name="" />
302
       <module name="" />
303
       <envs />
303
       <envs />
304
     </configuration>
304
     </configuration>
305
-    <configuration name="ConwayGameOfLifeTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
305
+    <configuration name="ConwayGameOfLifeTest.copyAndZeroOutTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
306
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
306
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
307
         <pattern>
307
         <pattern>
308
           <option name="PATTERN" value="com.zipcodeconway.*" />
308
           <option name="PATTERN" value="com.zipcodeconway.*" />
314
       <option name="ALTERNATIVE_JRE_PATH" />
314
       <option name="ALTERNATIVE_JRE_PATH" />
315
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
315
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
316
       <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
316
       <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
317
-      <option name="METHOD_NAME" />
318
-      <option name="TEST_OBJECT" value="class" />
317
+      <option name="METHOD_NAME" value="copyAndZeroOutTest" />
318
+      <option name="TEST_OBJECT" value="method" />
319
       <option name="VM_PARAMETERS" value="-ea" />
319
       <option name="VM_PARAMETERS" value="-ea" />
320
       <option name="PARAMETERS" />
320
       <option name="PARAMETERS" />
321
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
321
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
462
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
462
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
463
       <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
463
       <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
464
       <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
464
       <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
465
-      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
466
-      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
467
-      <item index="5" class="java.lang.String" itemvalue="Application.SimpleWindow" />
465
+      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
466
+      <item index="4" class="java.lang.String" itemvalue="Application.SimpleWindow" />
467
+      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.copyAndZeroOutTest" />
468
     </list>
468
     </list>
469
     <recent_temporary>
469
     <recent_temporary>
470
       <list size="5">
470
       <list size="5">
471
-        <item index="0" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
472
-        <item index="1" class="java.lang.String" itemvalue="Application.SimpleWindow" />
473
-        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
474
-        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
475
-        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
471
+        <item index="0" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.copyAndZeroOutTest" />
472
+        <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
473
+        <item index="2" class="java.lang.String" itemvalue="Application.SimpleWindow" />
474
+        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
475
+        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
476
       </list>
476
       </list>
477
     </recent_temporary>
477
     </recent_temporary>
478
   </component>
478
   </component>
491
       <updated>1519668901598</updated>
491
       <updated>1519668901598</updated>
492
       <workItem from="1519668902904" duration="14517000" />
492
       <workItem from="1519668902904" duration="14517000" />
493
       <workItem from="1520632065553" duration="7357000" />
493
       <workItem from="1520632065553" duration="7357000" />
494
-      <workItem from="1520694861381" duration="8629000" />
494
+      <workItem from="1520694861381" duration="11571000" />
495
+      <workItem from="1520894472201" duration="787000" />
495
     </task>
496
     </task>
496
     <servers />
497
     <servers />
497
   </component>
498
   </component>
498
   <component name="TestHistory">
499
   <component name="TestHistory">
499
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 15h 59m 00s.xml">
500
+    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 06m 11s.xml">
500
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
501
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
501
     </history-entry>
502
     </history-entry>
502
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 02m 03s.xml">
503
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
503
+    <history-entry file="ConwayGameOfLifeTest_copyAndZeroOutTest - 2018.03.10 at 13h 58m 29s.xml">
504
+      <configuration name="ConwayGameOfLifeTest.copyAndZeroOutTest" configurationId="JUnit" />
504
     </history-entry>
505
     </history-entry>
505
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 03m 01s.xml">
506
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
506
+    <history-entry file="ConwayGameOfLifeTest_copyAndZeroOutTest - 2018.03.10 at 14h 02m 40s.xml">
507
+      <configuration name="ConwayGameOfLifeTest.copyAndZeroOutTest" configurationId="JUnit" />
507
     </history-entry>
508
     </history-entry>
508
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 05m 07s.xml">
509
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
509
+    <history-entry file="ConwayGameOfLifeTest_copyAndZeroOutTest - 2018.03.10 at 14h 08m 46s.xml">
510
+      <configuration name="ConwayGameOfLifeTest.copyAndZeroOutTest" configurationId="JUnit" />
510
     </history-entry>
511
     </history-entry>
511
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 06m 11s.xml">
512
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
512
+    <history-entry file="ConwayGameOfLifeTest_copyAndZeroOutTest - 2018.03.12 at 18h 54m 28s.xml">
513
+      <configuration name="ConwayGameOfLifeTest.copyAndZeroOutTest" configurationId="JUnit" />
513
     </history-entry>
514
     </history-entry>
514
     <history-entry file="ConwayGameOfLifeTest_runTest - 2018.02.26 at 15h 41m 14s.xml">
515
     <history-entry file="ConwayGameOfLifeTest_runTest - 2018.02.26 at 15h 41m 14s.xml">
515
       <configuration name="ConwayGameOfLifeTest.runTest" configurationId="JUnit" />
516
       <configuration name="ConwayGameOfLifeTest.runTest" configurationId="JUnit" />
528
     </history-entry>
529
     </history-entry>
529
   </component>
530
   </component>
530
   <component name="TimeTrackingManager">
531
   <component name="TimeTrackingManager">
531
-    <option name="totallyTimeSpent" value="30503000" />
532
+    <option name="totallyTimeSpent" value="34232000" />
532
   </component>
533
   </component>
533
   <component name="ToolWindowManager">
534
   <component name="ToolWindowManager">
534
-    <frame x="-82" y="-1018" width="1658" height="985" extended-state="0" />
535
+    <frame x="216" y="-1013" width="1447" height="985" extended-state="0" />
535
     <editor active="true" />
536
     <editor active="true" />
536
     <layout>
537
     <layout>
537
       <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" />
538
       <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" />
542
       <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" />
543
       <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" />
543
       <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" />
544
       <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" />
544
       <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" />
545
       <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" />
545
-      <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.29662922" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
546
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19101124" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
546
       <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" />
547
       <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" />
547
       <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" />
548
       <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" />
548
       <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" />
549
       <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" />
549
       <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" />
550
       <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" />
550
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.11819307" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
551
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13736655" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
551
       <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" />
552
       <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" />
552
       <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" />
553
       <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" />
553
       <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" />
554
       <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" />
578
   <component name="editorHistoryManager">
579
   <component name="editorHistoryManager">
579
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
580
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
580
       <provider selected="true" editor-type-id="text-editor">
581
       <provider selected="true" editor-type-id="text-editor">
582
+        <state relative-caret-position="1140">
583
+          <caret line="81" column="15" lean-forward="true" selection-start-line="81" selection-start-column="15" selection-end-line="81" selection-end-column="15" />
584
+          <folding>
585
+            <element signature="imports" expanded="true" />
586
+          </folding>
587
+        </state>
588
+      </provider>
589
+    </entry>
590
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
591
+      <provider selected="true" editor-type-id="text-editor">
592
+        <state relative-caret-position="855">
593
+          <caret line="58" column="47" lean-forward="true" selection-start-line="54" selection-start-column="31" selection-end-line="58" selection-end-column="47" />
594
+          <folding>
595
+            <element signature="imports" expanded="true" />
596
+          </folding>
597
+        </state>
598
+      </provider>
599
+    </entry>
600
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
601
+      <provider selected="true" editor-type-id="text-editor">
602
+        <state relative-caret-position="1305">
603
+          <caret line="98" column="85" lean-forward="true" selection-start-line="98" selection-start-column="85" selection-end-line="98" selection-end-column="85" />
604
+          <folding>
605
+            <element signature="imports" expanded="true" />
606
+            <element signature="e#1432#1433#0" expanded="true" />
607
+            <element signature="e#1468#1469#0" expanded="true" />
608
+            <element signature="e#2265#2266#0" expanded="true" />
609
+            <element signature="e#2302#2303#0" expanded="true" />
610
+            <element signature="e#2347#2348#0" expanded="true" />
611
+            <element signature="e#2387#2388#0" expanded="true" />
612
+            <element signature="e#2916#2917#0" expanded="true" />
613
+            <element signature="e#2940#2941#0" expanded="true" />
614
+          </folding>
615
+        </state>
616
+      </provider>
617
+    </entry>
618
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
619
+      <provider selected="true" editor-type-id="text-editor">
581
         <state relative-caret-position="360">
620
         <state relative-caret-position="360">
582
           <caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
621
           <caret line="26" column="0" lean-forward="false" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
583
-          <folding />
622
+          <folding>
623
+            <element signature="imports" expanded="true" />
624
+          </folding>
584
         </state>
625
         </state>
585
       </provider>
626
       </provider>
586
     </entry>
627
     </entry>
590
           <caret line="28" column="53" lean-forward="true" selection-start-line="28" selection-start-column="53" selection-end-line="28" selection-end-column="53" />
631
           <caret line="28" column="53" lean-forward="true" selection-start-line="28" selection-start-column="53" selection-end-line="28" selection-end-column="53" />
591
           <folding>
632
           <folding>
592
             <element signature="imports" expanded="true" />
633
             <element signature="imports" expanded="true" />
593
-            <element signature="e#299#300#0" expanded="true" />
594
-            <element signature="e#341#342#0" expanded="true" />
595
-            <element signature="e#1158#1159#0" expanded="true" />
596
-            <element signature="e#1194#1195#0" expanded="true" />
597
-            <element signature="e#1991#1992#0" expanded="true" />
598
-            <element signature="e#2028#2029#0" expanded="true" />
599
-            <element signature="e#2073#2074#0" expanded="true" />
600
-            <element signature="e#2113#2114#0" expanded="true" />
601
-            <element signature="e#2642#2643#0" expanded="true" />
602
-            <element signature="e#2666#2667#0" expanded="true" />
634
+            <element signature="e#1432#1433#0" expanded="true" />
635
+            <element signature="e#1468#1469#0" expanded="true" />
636
+            <element signature="e#2265#2266#0" expanded="true" />
637
+            <element signature="e#2302#2303#0" expanded="true" />
638
+            <element signature="e#2347#2348#0" expanded="true" />
639
+            <element signature="e#2387#2388#0" expanded="true" />
640
+            <element signature="e#2916#2917#0" expanded="true" />
641
+            <element signature="e#2940#2941#0" expanded="true" />
603
           </folding>
642
           </folding>
604
         </state>
643
         </state>
605
       </provider>
644
       </provider>
630
           <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
669
           <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
631
           <folding>
670
           <folding>
632
             <element signature="imports" expanded="true" />
671
             <element signature="imports" expanded="true" />
633
-            <element signature="e#299#300#0" expanded="true" />
634
-            <element signature="e#341#342#0" expanded="true" />
635
-            <element signature="e#1158#1159#0" expanded="true" />
636
-            <element signature="e#1194#1195#0" expanded="true" />
637
-            <element signature="e#1991#1992#0" expanded="true" />
638
-            <element signature="e#2028#2029#0" expanded="true" />
639
-            <element signature="e#2073#2074#0" expanded="true" />
640
-            <element signature="e#2113#2114#0" expanded="true" />
641
-            <element signature="e#2642#2643#0" expanded="true" />
642
-            <element signature="e#2666#2667#0" expanded="true" />
672
+            <element signature="e#1432#1433#0" expanded="true" />
673
+            <element signature="e#1468#1469#0" expanded="true" />
674
+            <element signature="e#2265#2266#0" expanded="true" />
675
+            <element signature="e#2302#2303#0" expanded="true" />
676
+            <element signature="e#2347#2348#0" expanded="true" />
677
+            <element signature="e#2387#2388#0" expanded="true" />
678
+            <element signature="e#2916#2917#0" expanded="true" />
679
+            <element signature="e#2940#2941#0" expanded="true" />
643
           </folding>
680
           </folding>
644
         </state>
681
         </state>
645
       </provider>
682
       </provider>
648
       <provider selected="true" editor-type-id="text-editor">
685
       <provider selected="true" editor-type-id="text-editor">
649
         <state relative-caret-position="450">
686
         <state relative-caret-position="450">
650
           <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
687
           <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
651
-          <folding />
688
+          <folding>
689
+            <element signature="imports" expanded="true" />
690
+          </folding>
652
         </state>
691
         </state>
653
       </provider>
692
       </provider>
654
     </entry>
693
     </entry>
690
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
729
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
691
       <provider selected="true" editor-type-id="text-editor">
730
       <provider selected="true" editor-type-id="text-editor">
692
         <state relative-caret-position="870">
731
         <state relative-caret-position="870">
693
-          <caret line="58" column="47" lean-forward="true" selection-start-line="54" selection-start-column="31" selection-end-line="58" selection-end-column="47" />
732
+          <caret line="58" column="47" lean-forward="false" selection-start-line="54" selection-start-column="31" selection-end-line="58" selection-end-column="47" />
694
           <folding>
733
           <folding>
695
             <element signature="imports" expanded="true" />
734
             <element signature="imports" expanded="true" />
696
           </folding>
735
           </folding>
699
     </entry>
738
     </entry>
700
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
739
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
701
       <provider selected="true" editor-type-id="text-editor">
740
       <provider selected="true" editor-type-id="text-editor">
702
-        <state relative-caret-position="663">
703
-          <caret line="68" column="32" lean-forward="true" selection-start-line="68" selection-start-column="32" selection-end-line="68" selection-end-column="32" />
704
-          <folding />
741
+        <state relative-caret-position="378">
742
+          <caret line="66" column="21" lean-forward="true" selection-start-line="66" selection-start-column="21" selection-end-line="66" selection-end-column="21" />
743
+          <folding>
744
+            <element signature="imports" expanded="true" />
745
+          </folding>
705
         </state>
746
         </state>
706
       </provider>
747
       </provider>
707
     </entry>
748
     </entry>
708
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
749
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
709
       <provider selected="true" editor-type-id="text-editor">
750
       <provider selected="true" editor-type-id="text-editor">
710
-        <state relative-caret-position="-126">
711
-          <caret line="88" column="29" lean-forward="false" selection-start-line="88" selection-start-column="29" selection-end-line="88" selection-end-column="29" />
751
+        <state relative-caret-position="148">
752
+          <caret line="76" column="0" lean-forward="true" selection-start-line="76" selection-start-column="0" selection-end-line="76" selection-end-column="0" />
712
           <folding>
753
           <folding>
713
             <element signature="imports" expanded="true" />
754
             <element signature="imports" expanded="true" />
714
-            <element signature="e#299#300#0" expanded="true" />
715
-            <element signature="e#341#342#0" expanded="true" />
716
-            <element signature="e#1158#1159#0" expanded="true" />
717
-            <element signature="e#1194#1195#0" expanded="true" />
718
-            <element signature="e#1991#1992#0" expanded="true" />
719
-            <element signature="e#2028#2029#0" expanded="true" />
720
-            <element signature="e#2073#2074#0" expanded="true" />
721
-            <element signature="e#2113#2114#0" expanded="true" />
722
-            <element signature="e#2642#2643#0" expanded="true" />
723
-            <element signature="e#2666#2667#0" expanded="true" />
755
+            <element signature="e#1432#1433#0" expanded="true" />
756
+            <element signature="e#1468#1469#0" expanded="true" />
757
+            <element signature="e#2265#2266#0" expanded="true" />
758
+            <element signature="e#2302#2303#0" expanded="true" />
759
+            <element signature="e#2347#2348#0" expanded="true" />
760
+            <element signature="e#2387#2388#0" expanded="true" />
761
+            <element signature="e#2916#2917#0" expanded="true" />
762
+            <element signature="e#2940#2941#0" expanded="true" />
724
           </folding>
763
           </folding>
725
         </state>
764
         </state>
726
       </provider>
765
       </provider>

+ 10
- 34
src/main/java/com/zipcodeconway/ConwayGameOfLife.java View File

1
 package com.zipcodeconway;
1
 package com.zipcodeconway;
2
 
2
 
3
+import jdk.nashorn.internal.ir.visitor.SimpleNodeVisitor;
4
+
3
 import java.util.Arrays;
5
 import java.util.Arrays;
4
 import java.util.Random;
6
 import java.util.Random;
5
 
7
 
6
 public class ConwayGameOfLife {
8
 public class ConwayGameOfLife {
7
 
9
 
10
+    private SimpleWindow simpleWindow;
11
+
8
     private Integer dimension;
12
     private Integer dimension;
9
     private int[][] startMatrix;
13
     private int[][] startMatrix;
14
+    private int[][] nextGeneration;
10
     private int[][] nextArrayAfter;
15
     private int[][] nextArrayAfter;
11
     private int[][] currentArrayAfter;
16
     private int[][] currentArrayAfter;
12
 
17
 
13
     public ConwayGameOfLife(Integer dimension) {
18
     public ConwayGameOfLife(Integer dimension) {
14
-        this.dimension = dimension;
19
+        this.simpleWindow = new SimpleWindow(dimension);
20
+        this.startMatrix = createRandomStart(dimension);
21
+        this.nextGeneration = new int[dimension][dimension];
15
     }
22
     }
16
 
23
 
17
     public ConwayGameOfLife(Integer dimension, int[][] startMatrix) {
24
     public ConwayGameOfLife(Integer dimension, int[][] startMatrix) {
83
     public String rowsToString(int[][] arrayToPrint) {
90
     public String rowsToString(int[][] arrayToPrint) {
84
         StringBuilder sb = new StringBuilder();
91
         StringBuilder sb = new StringBuilder();
85
         for (int i = 0; i < arrayToPrint.length; i++) {
92
         for (int i = 0; i < arrayToPrint.length; i++) {
86
-            sb.append(arrayToPrint[i] + "\n");
93
+            sb.append(Arrays.toString(arrayToPrint[i]) + "\n");
87
         }
94
         }
88
-        sb.deleteCharAt(arrayToPrint.length - 1);
95
+        sb.deleteCharAt(sb.length() - 1);
89
         return sb.toString();
96
         return sb.toString();
90
     }
97
     }
91
 
98
 
93
         ConwayGameOfLife sim = new ConwayGameOfLife(50);
100
         ConwayGameOfLife sim = new ConwayGameOfLife(50);
94
         int[][] endingWorld = sim.simulate(50);
101
         int[][] endingWorld = sim.simulate(50);
95
 
102
 
96
-//        int[][] testArray3 = sim.createRandomStart(5);
97
-//
98
-//        for (int i = 0; i < testArray3.length; i++) {
99
-//            System.out.println("row " + i + ": " + Arrays.toString(testArray3[i]));
100
-//        }
101
-
102
-        int[][] nextArray = {
103
-                {0, 0, 0, 0, 0},
104
-                {0, 0, 0, 0, 0},
105
-                {0, 1, 1, 1, 0},
106
-                {0, 0, 0, 0, 0},
107
-                {0, 0, 0, 0, 0} };
108
-
109
-        int[][] currentArray = {
110
-                {0, 0, 0, 0, 0},
111
-                {0, 0, 1, 0, 0},
112
-                {0, 0, 1, 0, 0},
113
-                {0, 0, 1, 0, 0},
114
-                {0, 0, 0, 0, 0} };
115
-
116
-        System.out.println("nextArrayBefore:");
117
-        for (int i = 0; i < nextArray.length; i++) {
118
-            System.out.println(Arrays.toString(nextArray[i]));
119
-        }
120
-        System.out.println();
121
-        System.out.println("currentArrayBefore");
122
-        for (int i = 0; i < currentArray.length; i++) {
123
-            System.out.println(Arrays.toString(currentArray[i]));
124
-        }
125
-
126
-        sim.copyAndZeroOut(nextArray, currentArray);
127
     }
103
     }
128
 
104
 
129
 }
105
 }

+ 17
- 0
src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java View File

1
 package com.zipcodeconway;
1
 package com.zipcodeconway;
2
 
2
 
3
+import org.junit.Assert;
3
 import org.junit.Test;
4
 import org.junit.Test;
4
 
5
 
5
 import static org.junit.Assert.*;
6
 import static org.junit.Assert.*;
6
 
7
 
8
+import com.zipcodeconway.ConwayGameOfLife;
9
+
7
 public class ConwayGameOfLifeTest {
10
 public class ConwayGameOfLifeTest {
8
 
11
 
12
+    private ConwayGameOfLife sim;
13
+
9
     @Test
14
     @Test
10
     public void runTest1() {
15
     public void runTest1() {
11
         int[][] start = {
16
         int[][] start = {
46
 
51
 
47
     @Test
52
     @Test
48
     public void copyAndZeroOutTest() {
53
     public void copyAndZeroOutTest() {
54
+        // Given
49
         int[][] expectedNextArrayBefore = {
55
         int[][] expectedNextArrayBefore = {
50
                 {0, 0, 0, 0, 0},
56
                 {0, 0, 0, 0, 0},
51
                 {0, 0, 1, 0, 0},
57
                 {0, 0, 1, 0, 0},
70
                 {0, 0, 1, 0, 0},
76
                 {0, 0, 1, 0, 0},
71
                 {0, 0, 1, 0, 0},
77
                 {0, 0, 1, 0, 0},
72
                 {0, 0, 0, 0, 0} };
78
                 {0, 0, 0, 0, 0} };
79
+        sim = new ConwayGameOfLife(5, expectedCurrentArrayBefore);
80
+        String expectedNextArray = sim.rowsToString(expectedNextArrayAfter);
81
+        String expectedCurrentArray = sim.rowsToString(expectedCurrentArrayAfter);
82
+        // When
83
+        sim.copyAndZeroOut(expectedNextArrayBefore, expectedCurrentArrayBefore);
84
+        String actualNextArray = sim.rowsToString(sim.getNextArrayAfter());
85
+        String actualCurrentArray = sim.rowsToString(sim.getCurrentArrayAfter());
86
+        // Then
87
+        Assert.assertEquals(expectedNextArray, actualNextArray);
88
+        Assert.assertEquals(expectedCurrentArray, actualCurrentArray);
89
+
73
     }
90
     }
74
 
91
 
75
 }
92
 }