Bo Lee пре 6 година
родитељ
комит
ccf15ab4c8

+ 170
- 192
.idea/workspace.xml Прегледај датотеку

@@ -1,7 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4
-    <list default="true" id="e282cee1-bfe9-42a3-9794-9633eb4654d1" name="Default" comment="" />
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
+      <change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
7
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
8
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
9
+    </list>
5 10
     <ignored path="$PROJECT_DIR$/target/" />
6 11
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
7 12
     <option name="TRACKING_ENABLED" value="true" />
@@ -11,76 +16,32 @@
11 16
     <option name="LAST_RESOLUTION" value="IGNORE" />
12 17
   </component>
13 18
   <component name="FileEditorManager">
14
-    <leaf>
19
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
15 20
       <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="false">
16 21
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
17 22
           <provider selected="true" editor-type-id="text-editor">
18
-            <state relative-caret-position="289">
19
-              <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
20
-              <folding>
21
-                <element signature="imports" expanded="true" />
22
-              </folding>
23
+            <state relative-caret-position="319">
24
+              <caret line="34" column="57" lean-forward="true" selection-start-line="34" selection-start-column="57" selection-end-line="34" selection-end-column="57" />
25
+              <folding />
23 26
             </state>
24 27
           </provider>
25 28
         </entry>
26 29
       </file>
27
-      <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="false">
30
+      <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
28 31
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
29 32
           <provider selected="true" editor-type-id="text-editor">
30
-            <state relative-caret-position="164">
31
-              <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
32
-              <folding>
33
-                <element signature="e#585#586#0" expanded="true" />
34
-                <element signature="e#676#677#0" expanded="true" />
35
-                <element signature="e#712#713#0" expanded="true" />
36
-                <element signature="e#1429#1430#0" expanded="true" />
37
-                <element signature="e#1453#1454#0" expanded="true" />
38
-              </folding>
39
-            </state>
40
-          </provider>
41
-        </entry>
42
-      </file>
43
-      <file leaf-file-name="JAVA/com.zipcodeconway.ConwayGameOfLife" pinned="false" current-in-tab="false">
44
-        <entry file="uml://JAVA/com.zipcodeconway.ConwayGameOfLife">
45
-          <provider selected="true" editor-type-id="UmlEditorProvider">
46
-            <state>
47
-              <ID>JAVA</ID>
48
-              <OriginalElement>com.zipcodeconway.ConwayGameOfLife</OriginalElement>
49
-              <nodes>
50
-                <node x="-54.0" y="-179.0">com.zipcodeconway.ConwayGameOfLife</node>
51
-              </nodes>
52
-              <notes />
53
-              <edges />
54
-              <settings layout="Hierarchic Group" zoom="1.0" x="-203.0" y="-1.0" />
55
-              <SelectedNodes />
56
-              <Categories>
57
-                <Category>Constructors</Category>
58
-                <Category>Methods</Category>
59
-              </Categories>
60
-              <SCOPE>All</SCOPE>
61
-              <VISIBILITY>private</VISIBILITY>
62
-            </state>
63
-          </provider>
64
-        </entry>
65
-      </file>
66
-      <file leaf-file-name="README.md" pinned="false" current-in-tab="false">
67
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md">
68
-          <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
69
-            <state split_layout="SPLIT">
70
-              <first_editor relative-caret-position="236">
71
-                <caret line="52" column="194" lean-forward="false" selection-start-line="52" selection-start-column="194" selection-end-line="52" selection-end-column="194" />
72
-                <folding />
73
-              </first_editor>
74
-              <second_editor />
33
+            <state relative-caret-position="330">
34
+              <caret line="88" column="0" lean-forward="true" selection-start-line="88" selection-start-column="0" selection-end-line="99" selection-end-column="21" />
35
+              <folding />
75 36
             </state>
76 37
           </provider>
77 38
         </entry>
78 39
       </file>
79
-      <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
40
+      <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="false">
80 41
         <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
81 42
           <provider selected="true" editor-type-id="text-editor">
82
-            <state relative-caret-position="510">
83
-              <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
43
+            <state relative-caret-position="330">
44
+              <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
84 45
               <folding />
85 46
             </state>
86 47
           </provider>
@@ -126,8 +87,9 @@
126 87
         <option value="$PROJECT_DIR$/src/main/java/ConwayGameOfLife.java" />
127 88
         <option value="$PROJECT_DIR$/src/main/java/Life.java" />
128 89
         <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
129
-        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
130 90
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
91
+        <option value="$PROJECT_DIR$/README.md" />
92
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
131 93
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
132 94
       </list>
133 95
     </option>
@@ -138,11 +100,11 @@
138 100
     <detection-done>true</detection-done>
139 101
     <sorting>DEFINITION_ORDER</sorting>
140 102
   </component>
141
-  <component name="ProjectFrameBounds">
142
-    <option name="x" value="82" />
143
-    <option name="y" value="32" />
144
-    <option name="width" value="1440" />
145
-    <option name="height" value="821" />
103
+  <component name="ProjectFrameBounds" extendedState="6">
104
+    <option name="x" value="-134" />
105
+    <option name="y" value="-777" />
106
+    <option name="width" value="1280" />
107
+    <option name="height" value="777" />
146 108
   </component>
147 109
   <component name="ProjectView">
148 110
     <navigator currentView="ProjectPane" proportions="" version="1">
@@ -159,55 +121,56 @@
159 121
       <foldersAlwaysOnTop value="true" />
160 122
     </navigator>
161 123
     <panes>
124
+      <pane id="Scratches" />
162 125
       <pane id="ProjectPane">
163 126
         <subPane>
164 127
           <expand>
165 128
             <path>
166
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
167
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
129
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
130
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
168 131
             </path>
169 132
             <path>
170
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
171
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
133
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
134
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
172 135
               <item name="src" type="462c0819:PsiDirectoryNode" />
173 136
             </path>
174 137
             <path>
175
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
176
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
138
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
139
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
177 140
               <item name="src" type="462c0819:PsiDirectoryNode" />
178 141
               <item name="main" type="462c0819:PsiDirectoryNode" />
179 142
             </path>
180 143
             <path>
181
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
182
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
144
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
145
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
183 146
               <item name="src" type="462c0819:PsiDirectoryNode" />
184 147
               <item name="main" type="462c0819:PsiDirectoryNode" />
185 148
               <item name="java" type="462c0819:PsiDirectoryNode" />
186 149
             </path>
187 150
             <path>
188
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
189
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
151
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
152
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
190 153
               <item name="src" type="462c0819:PsiDirectoryNode" />
191 154
               <item name="main" type="462c0819:PsiDirectoryNode" />
192 155
               <item name="java" type="462c0819:PsiDirectoryNode" />
193 156
               <item name="zipcodeconway" type="462c0819:PsiDirectoryNode" />
194 157
             </path>
195 158
             <path>
196
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
197
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
159
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
160
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
198 161
               <item name="src" type="462c0819:PsiDirectoryNode" />
199 162
               <item name="test" type="462c0819:PsiDirectoryNode" />
200 163
             </path>
201 164
             <path>
202
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
203
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
165
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
166
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
204 167
               <item name="src" type="462c0819:PsiDirectoryNode" />
205 168
               <item name="test" type="462c0819:PsiDirectoryNode" />
206 169
               <item name="java" type="462c0819:PsiDirectoryNode" />
207 170
             </path>
208 171
             <path>
209
-              <item name="Game-Of-Life-Java" type="b2602c69:ProjectViewProjectNode" />
210
-              <item name="Game-Of-Life-Java" type="462c0819:PsiDirectoryNode" />
172
+              <item name="ConwayGameOfLife" type="b2602c69:ProjectViewProjectNode" />
173
+              <item name="ConwayGameOfLife" type="462c0819:PsiDirectoryNode" />
211 174
               <item name="src" type="462c0819:PsiDirectoryNode" />
212 175
               <item name="test" type="462c0819:PsiDirectoryNode" />
213 176
               <item name="java" type="462c0819:PsiDirectoryNode" />
@@ -219,7 +182,6 @@
219 182
       </pane>
220 183
       <pane id="PackagesPane" />
221 184
       <pane id="AndroidView" />
222
-      <pane id="Scratches" />
223 185
       <pane id="Scope" />
224 186
     </panes>
225 187
   </component>
@@ -227,7 +189,7 @@
227 189
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
228 190
     <property name="WebServerToolWindowFactoryState" value="false" />
229 191
     <property name="aspect.path.notification.shown" value="true" />
230
-    <property name="last_opened_file_path" value="$PROJECT_DIR$" />
192
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/pom.xml" />
231 193
     <property name="settings.editor.selected.configurable" value="preferences.lookFeel" />
232 194
     <property name="project.structure.last.edited" value="Modules" />
233 195
     <property name="project.structure.proportion" value="0.15" />
@@ -287,20 +249,6 @@
287 249
       <module name="Game-Of-Life-Java" />
288 250
       <envs />
289 251
     </configuration>
290
-    <configuration name="GameofLife" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
291
-      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
292
-      <option name="MAIN_CLASS_NAME" value="GameofLife" />
293
-      <option name="VM_PARAMETERS" />
294
-      <option name="PROGRAM_PARAMETERS" />
295
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
296
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
297
-      <option name="ALTERNATIVE_JRE_PATH" />
298
-      <option name="ENABLE_SWING_INSPECTOR" value="false" />
299
-      <option name="ENV_VARIABLES" />
300
-      <option name="PASS_PARENT_ENVS" value="true" />
301
-      <module name="Game-Of-Life-Java" />
302
-      <envs />
303
-    </configuration>
304 252
     <configuration default="true" type="Application" factoryName="Application">
305 253
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
306 254
       <option name="MAIN_CLASS_NAME" />
@@ -365,6 +313,31 @@
365 313
       <envs />
366 314
       <patterns />
367 315
     </configuration>
316
+    <configuration name="ConwayGameOfLifeTest.runTest1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
317
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
318
+        <pattern>
319
+          <option name="PATTERN" value="com.zipcodeconway.*" />
320
+          <option name="ENABLED" value="true" />
321
+        </pattern>
322
+      </extension>
323
+      <module name="Game-Of-Life-Java" />
324
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
325
+      <option name="ALTERNATIVE_JRE_PATH" />
326
+      <option name="PACKAGE_NAME" value="com.zipcodeconway" />
327
+      <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
328
+      <option name="METHOD_NAME" value="runTest1" />
329
+      <option name="TEST_OBJECT" value="method" />
330
+      <option name="VM_PARAMETERS" value="-ea" />
331
+      <option name="PARAMETERS" />
332
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
333
+      <option name="ENV_VARIABLES" />
334
+      <option name="PASS_PARENT_ENVS" value="true" />
335
+      <option name="TEST_SEARCH_SCOPE">
336
+        <value defaultName="singleModule" />
337
+      </option>
338
+      <envs />
339
+      <patterns />
340
+    </configuration>
368 341
     <configuration name="ConwayGameOfLifeTest.runTest2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
369 342
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
370 343
         <pattern>
@@ -473,19 +446,19 @@
473 446
     </configuration>
474 447
     <list size="6">
475 448
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
476
-      <item index="1" class="java.lang.String" itemvalue="Application.GameofLife" />
477
-      <item index="2" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
478
-      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
479
-      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
480
-      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
449
+      <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
450
+      <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
451
+      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
452
+      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
453
+      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
481 454
     </list>
482 455
     <recent_temporary>
483 456
       <list size="5">
484 457
         <item index="0" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
485 458
         <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
486
-        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
487
-        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
488
-        <item index="4" class="java.lang.String" itemvalue="Application.GameofLife" />
459
+        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
460
+        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
461
+        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
489 462
       </list>
490 463
     </recent_temporary>
491 464
   </component>
@@ -503,71 +476,84 @@
503 476
       <option name="presentableId" value="Default" />
504 477
       <updated>1519668901598</updated>
505 478
       <workItem from="1519668902904" duration="14517000" />
479
+      <workItem from="1520706516369" duration="39032000" />
506 480
     </task>
507 481
     <servers />
508 482
   </component>
509 483
   <component name="TestHistory">
510
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 15h 45m 01s.xml">
484
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 18h 44m 41s.xml">
511 485
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
512 486
     </history-entry>
513
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 15h 59m 00s.xml">
514
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
487
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 05m 36s.xml">
488
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
515 489
     </history-entry>
516
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 02m 03s.xml">
517
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
490
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 08m 45s.xml">
491
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
518 492
     </history-entry>
519
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 03m 01s.xml">
520
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
493
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 12m 29s.xml">
494
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
521 495
     </history-entry>
522
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 05m 07s.xml">
523
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
496
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 16m 56s.xml">
497
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
524 498
     </history-entry>
525
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 06m 11s.xml">
526
-      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
499
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 17m 18s.xml">
500
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
501
+    </history-entry>
502
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 20m 03s.xml">
503
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
527 504
     </history-entry>
528
-    <history-entry file="ConwayGameOfLifeTest_runTest - 2018.02.26 at 15h 41m 14s.xml">
529
-      <configuration name="ConwayGameOfLifeTest.runTest" configurationId="JUnit" />
505
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 22m 19s.xml">
506
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
530 507
     </history-entry>
531
-    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.02.26 at 15h 42m 02s.xml">
532
-      <configuration name="ConwayGameOfLifeTest.runTest2" configurationId="JUnit" />
508
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 22m 31s.xml">
509
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
533 510
     </history-entry>
534
-    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.02.26 at 15h 42m 18s.xml">
535
-      <configuration name="ConwayGameOfLifeTest.runTest2" configurationId="JUnit" />
511
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 16h 24m 05s.xml">
512
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
536 513
     </history-entry>
537 514
   </component>
538 515
   <component name="TimeTrackingManager">
539
-    <option name="totallyTimeSpent" value="14517000" />
516
+    <option name="totallyTimeSpent" value="53549000" />
517
+  </component>
518
+  <component name="TodoView">
519
+    <todo-panel id="selected-file">
520
+      <is-autoscroll-to-source value="true" />
521
+    </todo-panel>
522
+    <todo-panel id="all">
523
+      <are-packages-shown value="true" />
524
+      <is-autoscroll-to-source value="true" />
525
+    </todo-panel>
540 526
   </component>
541 527
   <component name="ToolWindowManager">
542
-    <frame x="82" y="32" width="1440" height="821" extended-state="0" />
528
+    <frame x="-134" y="-1057" width="1920" height="1057" extended-state="6" />
543 529
     <editor active="true" />
544 530
     <layout>
545
-      <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="-1" side_tool="false" content_ui="tabs" />
546
-      <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" />
547
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32833788" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
548
-      <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="-1" side_tool="false" content_ui="tabs" />
549
-      <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="-1" side_tool="false" content_ui="tabs" />
550
-      <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="-1" side_tool="false" content_ui="tabs" />
551
-      <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="-1" side_tool="true" content_ui="tabs" />
552
-      <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="-1" side_tool="false" content_ui="tabs" />
553
-      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32561308" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
554
-      <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="-1" side_tool="false" content_ui="tabs" />
555
-      <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="-1" side_tool="false" content_ui="tabs" />
556
-      <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="-1" side_tool="false" content_ui="tabs" />
557
-      <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="-1" side_tool="false" content_ui="tabs" />
558
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
559
-      <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="-1" side_tool="false" content_ui="tabs" />
560
-      <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" />
531
+      <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" />
532
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32935917" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
533
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3253638" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
534
+      <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" />
535
+      <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" />
536
+      <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" />
537
+      <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" />
538
+      <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" />
539
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.04054054" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
540
+      <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" />
541
+      <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" />
542
+      <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" />
543
+      <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" />
544
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.064430244" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
545
+      <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" />
546
+      <window_info id="Find" 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="1" side_tool="false" content_ui="tabs" />
547
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24959612" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
561 548
       <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" />
562
-      <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="-1" side_tool="false" content_ui="tabs" />
563
-      <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="-1" side_tool="false" content_ui="tabs" />
549
+      <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" />
550
+      <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" />
564 551
       <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" />
565
-      <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="-1" side_tool="true" content_ui="tabs" />
552
+      <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" />
566 553
       <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" />
567
-      <window_info id="Hierarchy" 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="2" side_tool="false" content_ui="combo" />
568 554
       <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" />
569 555
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
570
-      <window_info id="Find" 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="1" side_tool="false" content_ui="tabs" />
556
+      <window_info id="Hierarchy" 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="2" side_tool="false" content_ui="combo" />
571 557
       <window_info id="Inspection" 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="5" side_tool="false" content_ui="tabs" />
572 558
     </layout>
573 559
   </component>
@@ -579,35 +565,47 @@
579 565
   </component>
580 566
   <component name="XDebuggerManager">
581 567
     <breakpoint-manager>
582
-      <option name="time" value="2" />
568
+      <option name="time" value="6" />
583 569
     </breakpoint-manager>
584 570
     <watches-manager />
585 571
   </component>
586 572
   <component name="editorHistoryManager">
587
-    <entry file="file://$PROJECT_DIR$/pom.xml">
573
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
588 574
       <provider selected="true" editor-type-id="text-editor">
589
-        <state relative-caret-position="187">
590
-          <caret line="11" column="10" lean-forward="false" selection-start-line="11" selection-start-column="10" selection-end-line="11" selection-end-column="10" />
575
+        <state relative-caret-position="240">
576
+          <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
577
+          <folding>
578
+            <element signature="imports" expanded="false" />
579
+          </folding>
580
+        </state>
581
+      </provider>
582
+    </entry>
583
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
584
+      <provider selected="true" editor-type-id="text-editor">
585
+        <state relative-caret-position="300">
586
+          <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
591 587
           <folding />
592 588
         </state>
593 589
       </provider>
594 590
     </entry>
595
-    <entry file="file://$PROJECT_DIR$/src/main/java/LifeStarts.java">
591
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
596 592
       <provider selected="true" editor-type-id="text-editor">
597
-        <state relative-caret-position="272">
598
-          <caret line="16" column="5" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="16" selection-end-column="5" />
593
+        <state relative-caret-position="450">
594
+          <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
599 595
           <folding />
600 596
         </state>
601 597
       </provider>
602 598
     </entry>
603
-    <entry file="file://$PROJECT_DIR$/src/main/java/Life.java">
599
+    <entry file="file://$PROJECT_DIR$/pom.xml">
604 600
       <provider selected="true" editor-type-id="text-editor">
605
-        <state relative-caret-position="669">
606
-          <caret line="87" column="5" lean-forward="true" selection-start-line="47" selection-start-column="0" selection-end-line="87" selection-end-column="5" />
601
+        <state relative-caret-position="187">
602
+          <caret line="11" column="10" lean-forward="false" selection-start-line="11" selection-start-column="10" selection-end-line="11" selection-end-column="10" />
607 603
           <folding />
608 604
         </state>
609 605
       </provider>
610 606
     </entry>
607
+    <entry file="file://$PROJECT_DIR$/src/main/java/LifeStarts.java" />
608
+    <entry file="file://$PROJECT_DIR$/src/main/java/Life.java" />
611 609
     <entry file="uml://JAVA/com.zipcodeconway.ConwayGameOfLife">
612 610
       <provider selected="true" editor-type-id="UmlEditorProvider">
613 611
         <state>
@@ -629,63 +627,43 @@
629 627
         </state>
630 628
       </provider>
631 629
     </entry>
632
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md">
630
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
631
+    <entry file="file://$USER_HOME$/Downloads/ConwayLifeRandomat50.png" />
632
+    <entry file="file://$USER_HOME$/Documents/gitea/gitea/custom/public/img/ConwayLifeUML.png" />
633
+    <entry file="file://$PROJECT_DIR$/src/main/java/GameofLife.java" />
634
+    <entry file="file://$PROJECT_DIR$/README.md">
633 635
       <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
634
-        <state split_layout="SPLIT">
635
-          <first_editor relative-caret-position="236">
636
-            <caret line="52" column="194" lean-forward="false" selection-start-line="52" selection-start-column="194" selection-end-line="52" selection-end-column="194" />
637
-            <folding />
636
+        <state split_layout="SECOND">
637
+          <first_editor relative-caret-position="0">
638
+            <caret line="0" column="1" lean-forward="false" selection-start-line="0" selection-start-column="1" selection-end-line="0" selection-end-column="1" />
639
+            <folding>
640
+              <element signature="e#857#1209#0" expanded="false" />
641
+            </folding>
638 642
           </first_editor>
639 643
           <second_editor />
640 644
         </state>
641 645
       </provider>
642 646
     </entry>
643
-    <entry file="file://$USER_HOME$/Downloads/ConwayLifeRandomat50.png">
644
-      <provider selected="true" editor-type-id="images">
645
-        <state />
646
-      </provider>
647
-    </entry>
648
-    <entry file="file://$USER_HOME$/Documents/gitea/gitea/custom/public/img/ConwayLifeUML.png">
649
-      <provider selected="true" editor-type-id="images">
650
-        <state />
651
-      </provider>
652
-    </entry>
653
-    <entry file="file://$PROJECT_DIR$/src/main/java/GameofLife.java">
647
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
654 648
       <provider selected="true" editor-type-id="text-editor">
655
-        <state relative-caret-position="334">
656
-          <caret line="83" column="17" lean-forward="false" selection-start-line="82" selection-start-column="30" selection-end-line="83" selection-end-column="17" />
649
+        <state relative-caret-position="319">
650
+          <caret line="34" column="57" lean-forward="true" selection-start-line="34" selection-start-column="57" selection-end-line="34" selection-end-column="57" />
657 651
           <folding />
658 652
         </state>
659 653
       </provider>
660 654
     </entry>
661
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
655
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
662 656
       <provider selected="true" editor-type-id="text-editor">
663
-        <state relative-caret-position="289">
664
-          <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
665
-          <folding>
666
-            <element signature="imports" expanded="true" />
667
-          </folding>
657
+        <state relative-caret-position="330">
658
+          <caret line="24" column="0" lean-forward="false" selection-start-line="24" selection-start-column="0" selection-end-line="24" selection-end-column="0" />
659
+          <folding />
668 660
         </state>
669 661
       </provider>
670 662
     </entry>
671 663
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
672 664
       <provider selected="true" editor-type-id="text-editor">
673
-        <state relative-caret-position="164">
674
-          <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
675
-          <folding>
676
-            <element signature="e#585#586#0" expanded="true" />
677
-            <element signature="e#676#677#0" expanded="true" />
678
-            <element signature="e#712#713#0" expanded="true" />
679
-            <element signature="e#1429#1430#0" expanded="true" />
680
-            <element signature="e#1453#1454#0" expanded="true" />
681
-          </folding>
682
-        </state>
683
-      </provider>
684
-    </entry>
685
-    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
686
-      <provider selected="true" editor-type-id="text-editor">
687
-        <state relative-caret-position="510">
688
-          <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
665
+        <state relative-caret-position="330">
666
+          <caret line="88" column="0" lean-forward="true" selection-start-line="88" selection-start-column="0" selection-end-line="99" selection-end-column="21" />
689 667
           <folding />
690 668
         </state>
691 669
       </provider>

+ 1
- 1
README.md Прегледај датотеку

@@ -1,4 +1,4 @@
1
-# Conway's Game of Life
1
+3# Conway's Game of Life
2 2
 
3 3
 The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.
4 4
 

+ 156
- 4
src/main/java/com/zipcodeconway/ConwayGameOfLife.java Прегледај датотеку

@@ -2,31 +2,75 @@ package com.zipcodeconway;
2 2
 
3 3
 public class ConwayGameOfLife {
4 4
 
5
+    private int generations;
6
+    private int[][] currentGeneration;
7
+    private int[][] next;
8
+    private SimpleWindow displayWindow;
9
+
10
+//constructor to create a random start
5 11
     public ConwayGameOfLife(Integer dimension) {
6
-     }
12
+        currentGeneration = createRandomStart(dimension);
13
+        this.displayWindow = new SimpleWindow(dimension);
14
+        next = new int [dimension][dimension];
7 15
 
16
+    }
17
+//constructor to start with a set board
8 18
     public ConwayGameOfLife(Integer dimension, int[][] startmatrix) {
19
+        currentGeneration = startmatrix;
20
+        this.displayWindow = new SimpleWindow(dimension);
21
+        next = new int [dimension][dimension];
22
+
23
+
9 24
     }
10 25
 
11 26
     public static void main(String[] args) {
12 27
         ConwayGameOfLife sim = new ConwayGameOfLife(50);
13 28
         int[][] endingWorld = sim.simulate(50);
29
+
14 30
     }
15 31
 
16 32
     // Contains the logic for the starting scenario.
17 33
     // Which cells are alive or dead in generation 0.
18 34
     // allocates and returns the starting matrix of size 'dimension'
19 35
     private int[][] createRandomStart(Integer dimension) {
20
-        return new int[1][1];
36
+        currentGeneration = new int[dimension][dimension];
37
+        for (int x = 0; x < dimension; x++) {
38
+            for (int y = 0; y < dimension; y++) {
39
+                currentGeneration[x][y] =  (int)(Math.random() * 2);
40
+            }
41
+        }
42
+        return currentGeneration;
21 43
     }
22 44
 
23 45
     public int[][] simulate(Integer maxGenerations) {
24
-        return new int[1][1];
46
+        for (int i = 0; i <= maxGenerations; i++) {
47
+            this.displayWindow.display(currentGeneration, generations);
48
+            for (int a = 0; a < currentGeneration.length ; a++) {
49
+                for (int b = 0; b < currentGeneration[a].length; b++) {
50
+                 next[a][b] = isAlive(a, b, currentGeneration);
51
+                }
52
+
53
+            }
54
+            copyAndZeroOut(next, currentGeneration);
55
+            this.displayWindow.sleep(125);
56
+            generations++;
57
+
58
+        }
59
+        return currentGeneration;
25 60
     }
26 61
 
27 62
     // copy the values of 'next' matrix to 'current' matrix,
28 63
     // and then zero out the contents of 'next' matrix
29 64
     public void copyAndZeroOut(int [][] next, int[][] current) {
65
+
66
+        for (int i = 0; i <next.length ; i++) {
67
+            for (int j = 0; j < next.length ; j++) {
68
+                current[i][j] = next[i][j];
69
+                next[i][j] = 0;
70
+            }
71
+        }
72
+
73
+
30 74
     }
31 75
 
32 76
     // Calculate if an individual cell should be alive in the next generation.
@@ -38,6 +82,114 @@ public class ConwayGameOfLife {
38 82
 		Any dead cell with exactly three live neighbours cells will come to life.
39 83
 	*/
40 84
     private int isAlive(int row, int col, int[][] world) {
41
-        return 0;
85
+        int north = col -1;
86
+        int south = col +1;
87
+        int east = row +1;
88
+        int west = row -1;
89
+
90
+        if(north < 0){
91
+            north = world[row].length - 1;
92
+        }
93
+        if(south == world[row].length){
94
+            south = 0;
95
+        }
96
+        if(west < 0){
97
+            west = world[col].length-1;
98
+        }
99
+        if (east == world[col].length) {
100
+            east = 0;
101
+        }
102
+
103
+        int aliveNeighbors = world[row][north] + world[east][north] + world[west][north]
104
+                + world[row][south] + world[east][south] + world[west][south]
105
+                + world[east][col] + world[west][col];
106
+
107
+        if (aliveNeighbors == 3){
108
+            return 1;
109
+        }
110
+        if (aliveNeighbors < 2){
111
+            return 0;
112
+        }
113
+        if (aliveNeighbors > 3){
114
+            return 0;
115
+        }
116
+        return world[row][col];
117
+
118
+
42 119
     }
120
+
121
+
122
+
123
+//
124
+//        int aliveNeighbors = 0;
125
+//        for (int i = -1; i <= 1; i++) {
126
+//            for (int j = -1; j <= 1; j++) {
127
+////                aliveNeighbors += world
128
+////                        [(i + row) % world[row].length]
129
+////                        [(j + col) % world[col].length];
130
+//            }
131
+//        }
132
+//                aliveNeighbors -= world[row][col];
133
+//                //Rules of Life
134
+//                //cell is lonely and dies
135
+//
136
+//                if ((world[row][col] == 1) && (aliveNeighbors < 2)) {
137
+//                    next[row][col] = 0;
138
+//                }
139
+//                //cell is overcrowded and dies
140
+//                else if ((world[row][col] == 1) && (aliveNeighbors > 3)) {
141
+//                    next[row][col] = 0;
142
+//                }
143
+//                //dead cell comes to life
144
+//                else if ((world[row][col] == 0) && (aliveNeighbors == 3)) {
145
+//                    next[row][col] = 1;
146
+//                }
147
+//                //cell remains unchanged
148
+//                else {
149
+//                    next[row][col] = world[row][col];
150
+//                }
151
+//
152
+//        return next[row][col];
153
+//
154
+//    }
155
+//
156
+//
157
+
158
+
159
+
160
+//        next = new int[row][col];
161
+//        for (int x = 1; x < row -1  ; x++) {
162
+//            for (int y = 1; y < col -1  ; y++) {
163
+//                int aliveNeighbors = 0;
164
+//                for (int j = -1; j <= 1; j++) {
165
+//                    for (int k = -1; k <= 1; k++) {
166
+//
167
+//                        aliveNeighbors += world[(x + j+row) % row][(y + k + col) %col];
168
+//
169
+//                        //cell needs to be subtracted from aliveNeighbors because it was counted before
170
+//                        aliveNeighbors -= world[x][y];
171
+//                        //Rules of Life
172
+//                        //cell is lonely and dies
173
+//                        if ((world[x][y] == 1) && (aliveNeighbors < 2)) {
174
+//                            next[x][y] = 0;
175
+//                        }
176
+//                        //cell is overcrowded and dies
177
+//                        else if ((world[x][y] == 1) && (aliveNeighbors > 3)) {
178
+//                            next[x][y] = 0;
179
+//                        }
180
+//                        //dead cell comes to life
181
+//                        else if ((world[x][y] == 0) && (aliveNeighbors == 3)) {
182
+//                            next[x][y] = 1;
183
+//                        }
184
+//                        //cell remains unchanged
185
+//                        else {
186
+//                            next[x][y] = world[x][y];
187
+//                        }
188
+//                    }
189
+//                }
190
+//
191
+//            }
192
+//            return world[x][y];
193
+
194
+
43 195
 }

+ 2
- 2
src/main/java/com/zipcodeconway/SimpleWindow.java Прегледај датотеку

@@ -39,11 +39,11 @@ public class SimpleWindow {
39 39
             for (int j = 0; j < array[0].length; j++) {
40 40
                 g.drawRect(i * BOX_DIM, j * BOX_DIM, 10, 10);
41 41
                 if (array[i][j] == 0) {
42
-                    g.setColor(Color.WHITE);
42
+                    g.setColor(Color.LIGHT_GRAY);
43 43
                     g.fillRect(i * BOX_DIM, j * BOX_DIM, 10, 10);
44 44
                 }
45 45
                 if (array[i][j] == 1) {
46
-                    g.setColor(Color.BLACK);
46
+                    g.setColor(Color.YELLOW);
47 47
                     g.fillRect(i * BOX_DIM, j * BOX_DIM, 10, 10);
48 48
                 }
49 49
             }