Bläddra i källkod

advancing on Conway Game of Life

Luis Romero 6 år sedan
förälder
incheckning
0ca8d0bde8

+ 124
- 85
.idea/workspace.xml Visa fil

@@ -15,15 +15,17 @@
15 15
     <option name="LAST_RESOLUTION" value="IGNORE" />
16 16
   </component>
17 17
   <component name="FileEditorManager">
18
-    <splitter split-orientation="horizontal" split-proportion="0.43157893">
18
+    <splitter split-orientation="horizontal" split-proportion="0.3061056">
19 19
       <split-first>
20 20
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
21 21
           <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
22 22
             <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
23 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 29
                 </state>
28 30
               </provider>
29 31
             </entry>
@@ -36,7 +38,7 @@
36 38
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
37 39
               <provider selected="true" editor-type-id="text-editor">
38 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 42
                   <folding>
41 43
                     <element signature="imports" expanded="true" />
42 44
                   </folding>
@@ -47,20 +49,18 @@
47 49
           <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
48 50
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
49 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 54
                   <folding>
53 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 64
                   </folding>
65 65
                 </state>
66 66
               </provider>
@@ -121,9 +121,9 @@
121 121
     <sorting>DEFINITION_ORDER</sorting>
122 122
   </component>
123 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 127
     <option name="height" value="985" />
128 128
   </component>
129 129
   <component name="ProjectView">
@@ -142,7 +142,6 @@
142 142
     </navigator>
143 143
     <panes>
144 144
       <pane id="Scratches" />
145
-      <pane id="PackagesPane" />
146 145
       <pane id="AndroidView" />
147 146
       <pane id="ProjectPane">
148 147
         <subPane>
@@ -203,6 +202,7 @@
203 202
         </subPane>
204 203
       </pane>
205 204
       <pane id="Scope" />
205
+      <pane id="PackagesPane" />
206 206
     </panes>
207 207
   </component>
208 208
   <component name="PropertiesComponent">
@@ -242,7 +242,7 @@
242 242
       </list>
243 243
     </option>
244 244
   </component>
245
-  <component name="RunManager" selected="Application.ConwayGameOfLife">
245
+  <component name="RunManager" selected="JUnit.ConwayGameOfLifeTest.copyAndZeroOutTest">
246 246
     <configuration default="true" type="Applet" factoryName="Applet">
247 247
       <option name="HTML_USED" value="false" />
248 248
       <option name="WIDTH" value="400" />
@@ -302,7 +302,7 @@
302 302
       <module name="" />
303 303
       <envs />
304 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 306
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
307 307
         <pattern>
308 308
           <option name="PATTERN" value="com.zipcodeconway.*" />
@@ -314,8 +314,8 @@
314 314
       <option name="ALTERNATIVE_JRE_PATH" />
315 315
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
316 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 319
       <option name="VM_PARAMETERS" value="-ea" />
320 320
       <option name="PARAMETERS" />
321 321
       <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
@@ -462,17 +462,17 @@
462 462
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
463 463
       <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
464 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 468
     </list>
469 469
     <recent_temporary>
470 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 476
       </list>
477 477
     </recent_temporary>
478 478
   </component>
@@ -491,25 +491,26 @@
491 491
       <updated>1519668901598</updated>
492 492
       <workItem from="1519668902904" duration="14517000" />
493 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 496
     </task>
496 497
     <servers />
497 498
   </component>
498 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 501
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
501 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 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 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 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 514
     </history-entry>
514 515
     <history-entry file="ConwayGameOfLifeTest_runTest - 2018.02.26 at 15h 41m 14s.xml">
515 516
       <configuration name="ConwayGameOfLifeTest.runTest" configurationId="JUnit" />
@@ -528,10 +529,10 @@
528 529
     </history-entry>
529 530
   </component>
530 531
   <component name="TimeTrackingManager">
531
-    <option name="totallyTimeSpent" value="30503000" />
532
+    <option name="totallyTimeSpent" value="34232000" />
532 533
   </component>
533 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 536
     <editor active="true" />
536 537
     <layout>
537 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,12 +543,12 @@
542 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 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 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 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 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 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 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 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 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 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,9 +579,49 @@
578 579
   <component name="editorHistoryManager">
579 580
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
580 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 620
         <state relative-caret-position="360">
582 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 625
         </state>
585 626
       </provider>
586 627
     </entry>
@@ -590,16 +631,14 @@
590 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 632
           <folding>
592 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 642
           </folding>
604 643
         </state>
605 644
       </provider>
@@ -630,16 +669,14 @@
630 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 670
           <folding>
632 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 680
           </folding>
644 681
         </state>
645 682
       </provider>
@@ -648,7 +685,9 @@
648 685
       <provider selected="true" editor-type-id="text-editor">
649 686
         <state relative-caret-position="450">
650 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 691
         </state>
653 692
       </provider>
654 693
     </entry>
@@ -690,7 +729,7 @@
690 729
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
691 730
       <provider selected="true" editor-type-id="text-editor">
692 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 733
           <folding>
695 734
             <element signature="imports" expanded="true" />
696 735
           </folding>
@@ -699,28 +738,28 @@
699 738
     </entry>
700 739
     <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
701 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 746
         </state>
706 747
       </provider>
707 748
     </entry>
708 749
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
709 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 753
           <folding>
713 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 763
           </folding>
725 764
         </state>
726 765
       </provider>

+ 10
- 34
src/main/java/com/zipcodeconway/ConwayGameOfLife.java Visa fil

@@ -1,17 +1,24 @@
1 1
 package com.zipcodeconway;
2 2
 
3
+import jdk.nashorn.internal.ir.visitor.SimpleNodeVisitor;
4
+
3 5
 import java.util.Arrays;
4 6
 import java.util.Random;
5 7
 
6 8
 public class ConwayGameOfLife {
7 9
 
10
+    private SimpleWindow simpleWindow;
11
+
8 12
     private Integer dimension;
9 13
     private int[][] startMatrix;
14
+    private int[][] nextGeneration;
10 15
     private int[][] nextArrayAfter;
11 16
     private int[][] currentArrayAfter;
12 17
 
13 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 24
     public ConwayGameOfLife(Integer dimension, int[][] startMatrix) {
@@ -83,9 +90,9 @@ public class ConwayGameOfLife {
83 90
     public String rowsToString(int[][] arrayToPrint) {
84 91
         StringBuilder sb = new StringBuilder();
85 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 96
         return sb.toString();
90 97
     }
91 98
 
@@ -93,37 +100,6 @@ public class ConwayGameOfLife {
93 100
         ConwayGameOfLife sim = new ConwayGameOfLife(50);
94 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 Visa fil

@@ -1,11 +1,16 @@
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
 
8
+import com.zipcodeconway.ConwayGameOfLife;
9
+
7 10
 public class ConwayGameOfLifeTest {
8 11
 
12
+    private ConwayGameOfLife sim;
13
+
9 14
     @Test
10 15
     public void runTest1() {
11 16
         int[][] start = {
@@ -46,6 +51,7 @@ public class ConwayGameOfLifeTest {
46 51
 
47 52
     @Test
48 53
     public void copyAndZeroOutTest() {
54
+        // Given
49 55
         int[][] expectedNextArrayBefore = {
50 56
                 {0, 0, 0, 0, 0},
51 57
                 {0, 0, 1, 0, 0},
@@ -70,6 +76,17 @@ public class ConwayGameOfLifeTest {
70 76
                 {0, 0, 1, 0, 0},
71 77
                 {0, 0, 1, 0, 0},
72 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
 }