Преглед изворни кода

Merge 5fe98a27b51dd4ad593f10b60351ce4c5dae2557 into 2286bf332a6a66859fa1ab1a7063f5e3ecc912fc

CWinarski пре 6 година
родитељ
комит
8510f55023
No account linked to committer's email

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

@@ -11,15 +11,13 @@
11 11
     <option name="LAST_RESOLUTION" value="IGNORE" />
12 12
   </component>
13 13
   <component name="FileEditorManager">
14
-    <leaf>
15
-      <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="false">
16
-        <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
14
+    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
15
+      <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="false">
16
+        <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
17 17
           <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>
18
+            <state relative-caret-position="165">
19
+              <caret line="13" column="2" lean-forward="true" selection-start-line="13" selection-start-column="2" selection-end-line="13" selection-end-column="2" />
20
+              <folding />
23 21
             </state>
24 22
           </provider>
25 23
         </entry>
@@ -27,61 +25,21 @@
27 25
       <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="false">
28 26
         <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
29 27
           <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 />
28
+            <state relative-caret-position="223">
29
+              <caret line="18" column="25" lean-forward="true" selection-start-line="18" selection-start-column="25" selection-end-line="18" selection-end-column="25" />
30
+              <folding />
75 31
             </state>
76 32
           </provider>
77 33
         </entry>
78 34
       </file>
79
-      <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
80
-        <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
35
+      <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="true">
36
+        <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
81 37
           <provider selected="true" editor-type-id="text-editor">
82 38
             <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" />
84
-              <folding />
39
+              <caret line="35" column="41" lean-forward="true" selection-start-line="35" selection-start-column="41" selection-end-line="35" selection-end-column="41" />
40
+              <folding>
41
+                <element signature="imports" expanded="true" />
42
+              </folding>
85 43
             </state>
86 44
           </provider>
87 45
         </entry>
@@ -92,8 +50,8 @@
92 50
     <option name="RECENT_TEMPLATES">
93 51
       <list>
94 52
         <option value="Arquillian JUnit Test Class" />
95
-        <option value="Class" />
96 53
         <option value="JUnit4 Test Class" />
54
+        <option value="Class" />
97 55
       </list>
98 56
     </option>
99 57
   </component>
@@ -126,9 +84,12 @@
126 84
         <option value="$PROJECT_DIR$/src/main/java/ConwayGameOfLife.java" />
127 85
         <option value="$PROJECT_DIR$/src/main/java/Life.java" />
128 86
         <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
129
-        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
130 87
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
88
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/GetNeighbors.java" />
89
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/Neighbors.java" />
90
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/Cell.java" />
131 91
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
92
+        <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
132 93
       </list>
133 94
     </option>
134 95
   </component>
@@ -138,11 +99,11 @@
138 99
     <detection-done>true</detection-done>
139 100
     <sorting>DEFINITION_ORDER</sorting>
140 101
   </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" />
102
+  <component name="ProjectFrameBounds" fullScreen="true">
103
+    <option name="x" value="-241" />
104
+    <option name="y" value="-1080" />
105
+    <option name="width" value="1920" />
106
+    <option name="height" value="1080" />
146 107
   </component>
147 108
   <component name="ProjectView">
148 109
     <navigator currentView="ProjectPane" proportions="" version="1">
@@ -159,55 +120,57 @@
159 120
       <foldersAlwaysOnTop value="true" />
160 121
     </navigator>
161 122
     <panes>
123
+      <pane id="AndroidView" />
124
+      <pane id="PackagesPane" />
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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
130
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
134
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
139
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
145
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
152
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
160
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
166
+              <item name="GameOfLife" 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="GameOfLife" type="b2602c69:ProjectViewProjectNode" />
173
+              <item name="GameOfLife" 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" />
@@ -217,10 +180,8 @@
217 180
           <select />
218 181
         </subPane>
219 182
       </pane>
220
-      <pane id="PackagesPane" />
221
-      <pane id="AndroidView" />
222
-      <pane id="Scratches" />
223 183
       <pane id="Scope" />
184
+      <pane id="Scratches" />
224 185
     </panes>
225 186
   </component>
226 187
   <component name="PropertiesComponent">
@@ -238,14 +199,17 @@
238 199
     <key name="CreateTestDialog.RecentsKey">
239 200
       <recent name="com.zipcodeconway" />
240 201
     </key>
241
-    <key name="CopyFile.RECENT_KEYS">
242
-      <recent name="$PROJECT_DIR$" />
202
+    <key name="MoveFile.RECENT_KEYS">
203
+      <recent name="$PROJECT_DIR$/src/main/java" />
204
+    </key>
205
+    <key name="CreateClassDialog.RecentsKey">
206
+      <recent name="com.zipcodeconway" />
243 207
     </key>
244 208
     <key name="CreateTestDialog.Recents.Supers">
245 209
       <recent name="" />
246 210
     </key>
247
-    <key name="MoveFile.RECENT_KEYS">
248
-      <recent name="$PROJECT_DIR$/src/main/java" />
211
+    <key name="CopyFile.RECENT_KEYS">
212
+      <recent name="$PROJECT_DIR$" />
249 213
     </key>
250 214
   </component>
251 215
   <component name="RunDashboard">
@@ -260,7 +224,7 @@
260 224
       </list>
261 225
     </option>
262 226
   </component>
263
-  <component name="RunManager" selected="JUnit.ConwayGameOfLifeTest">
227
+  <component name="RunManager" selected="Application.ConwayGameOfLife">
264 228
     <configuration default="true" type="Applet" factoryName="Applet">
265 229
       <option name="HTML_USED" value="false" />
266 230
       <option name="WIDTH" value="400" />
@@ -287,20 +251,6 @@
287 251
       <module name="Game-Of-Life-Java" />
288 252
       <envs />
289 253
     </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 254
     <configuration default="true" type="Application" factoryName="Application">
305 255
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
306 256
       <option name="MAIN_CLASS_NAME" />
@@ -365,6 +315,31 @@
365 315
       <envs />
366 316
       <patterns />
367 317
     </configuration>
318
+    <configuration name="ConwayGameOfLifeTest.runTest1" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
319
+      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
320
+        <pattern>
321
+          <option name="PATTERN" value="com.zipcodeconway.*" />
322
+          <option name="ENABLED" value="true" />
323
+        </pattern>
324
+      </extension>
325
+      <module name="Game-Of-Life-Java" />
326
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
327
+      <option name="ALTERNATIVE_JRE_PATH" />
328
+      <option name="PACKAGE_NAME" value="com.zipcodeconway" />
329
+      <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
330
+      <option name="METHOD_NAME" value="runTest1" />
331
+      <option name="TEST_OBJECT" value="method" />
332
+      <option name="VM_PARAMETERS" value="-ea" />
333
+      <option name="PARAMETERS" />
334
+      <option name="WORKING_DIRECTORY" value="%MODULE_WORKING_DIR%" />
335
+      <option name="ENV_VARIABLES" />
336
+      <option name="PASS_PARENT_ENVS" value="true" />
337
+      <option name="TEST_SEARCH_SCOPE">
338
+        <value defaultName="singleModule" />
339
+      </option>
340
+      <envs />
341
+      <patterns />
342
+    </configuration>
368 343
     <configuration name="ConwayGameOfLifeTest.runTest2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
369 344
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
370 345
         <pattern>
@@ -473,19 +448,19 @@
473 448
     </configuration>
474 449
     <list size="6">
475 450
       <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" />
451
+      <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
452
+      <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
453
+      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest2" />
454
+      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
455
+      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
481 456
     </list>
482 457
     <recent_temporary>
483 458
       <list size="5">
484
-        <item index="0" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
485
-        <item index="1" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
459
+        <item index="0" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
460
+        <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
486 461
         <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" />
462
+        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
463
+        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest" />
489 464
       </list>
490 465
     </recent_temporary>
491 466
   </component>
@@ -503,71 +478,85 @@
503 478
       <option name="presentableId" value="Default" />
504 479
       <updated>1519668901598</updated>
505 480
       <workItem from="1519668902904" duration="14517000" />
481
+      <workItem from="1520797848180" duration="4062000" />
482
+      <workItem from="1520878553670" duration="18676000" />
506 483
     </task>
507 484
     <servers />
508 485
   </component>
509 486
   <component name="TestHistory">
510
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 15h 45m 01s.xml">
487
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 19h 53m 18s.xml">
511 488
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
512 489
     </history-entry>
513
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 15h 59m 00s.xml">
490
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 19h 55m 03s.xml">
514 491
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
515 492
     </history-entry>
516
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 02m 03s.xml">
493
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 20h 15m 45s.xml">
517 494
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
518 495
     </history-entry>
519
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 03m 01s.xml">
496
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 20h 18m 40s.xml">
520 497
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
521 498
     </history-entry>
522
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 05m 07s.xml">
499
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 20h 24m 26s.xml">
523 500
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
524 501
     </history-entry>
525
-    <history-entry file="ConwayGameOfLifeTest - 2018.02.26 at 16h 06m 11s.xml">
502
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 20h 25m 37s.xml">
526 503
       <configuration name="ConwayGameOfLifeTest" 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 - 2018.03.12 at 20h 27m 36s.xml">
506
+      <configuration name="ConwayGameOfLifeTest" 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 - 2018.03.12 at 20h 35m 42s.xml">
509
+      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
533 510
     </history-entry>
534
-    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.02.26 at 15h 42m 18s.xml">
511
+    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 20h 03m 53s.xml">
512
+      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
513
+    </history-entry>
514
+    <history-entry file="ConwayGameOfLifeTest_runTest2 - 2018.03.12 at 20h 03m 59s.xml">
535 515
       <configuration name="ConwayGameOfLifeTest.runTest2" configurationId="JUnit" />
536 516
     </history-entry>
537 517
   </component>
538 518
   <component name="TimeTrackingManager">
539
-    <option name="totallyTimeSpent" value="14517000" />
519
+    <option name="totallyTimeSpent" value="37255000" />
520
+  </component>
521
+  <component name="TodoView">
522
+    <todo-panel id="selected-file">
523
+      <is-autoscroll-to-source value="true" />
524
+    </todo-panel>
525
+    <todo-panel id="all">
526
+      <are-packages-shown value="true" />
527
+      <is-autoscroll-to-source value="true" />
528
+    </todo-panel>
540 529
   </component>
541 530
   <component name="ToolWindowManager">
542
-    <frame x="82" y="32" width="1440" height="821" extended-state="0" />
531
+    <frame x="-241" y="-1080" width="1920" height="1080" extended-state="0" />
543 532
     <editor active="true" />
544 533
     <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" />
534
+      <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" />
535
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32969216" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
536
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32770607" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
537
+      <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" />
538
+      <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" />
539
+      <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" />
540
+      <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" />
541
+      <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" />
542
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3247269" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
543
+      <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" />
544
+      <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" />
545
+      <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" />
546
+      <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" />
547
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19169329" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
548
+      <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" />
549
+      <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" />
560 550
       <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" />
561 551
       <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" />
552
+      <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" />
553
+      <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 554
       <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" />
555
+      <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 556
       <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 557
       <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 558
       <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" />
559
+      <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 560
       <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 561
     </layout>
573 562
   </component>
@@ -579,35 +568,63 @@
579 568
   </component>
580 569
   <component name="XDebuggerManager">
581 570
     <breakpoint-manager>
582
-      <option name="time" value="2" />
571
+      <option name="time" value="4" />
583 572
     </breakpoint-manager>
584 573
     <watches-manager />
585 574
   </component>
586 575
   <component name="editorHistoryManager">
587
-    <entry file="file://$PROJECT_DIR$/pom.xml">
576
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
588 577
       <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" />
578
+        <state relative-caret-position="0">
579
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
591 580
           <folding />
592 581
         </state>
593 582
       </provider>
594 583
     </entry>
595
-    <entry file="file://$PROJECT_DIR$/src/main/java/LifeStarts.java">
584
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
596 585
       <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" />
586
+        <state relative-caret-position="270">
587
+          <caret line="19" column="43" lean-forward="false" selection-start-line="19" selection-start-column="43" selection-end-line="19" selection-end-column="43" />
599 588
           <folding />
600 589
         </state>
601 590
       </provider>
602 591
     </entry>
603
-    <entry file="file://$PROJECT_DIR$/src/main/java/Life.java">
592
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
593
+      <provider selected="true" editor-type-id="text-editor">
594
+        <state relative-caret-position="240">
595
+          <caret line="17" column="42" lean-forward="false" selection-start-line="17" selection-start-column="42" selection-end-line="17" selection-end-column="42" />
596
+          <folding>
597
+            <element signature="imports" expanded="true" />
598
+          </folding>
599
+        </state>
600
+      </provider>
601
+    </entry>
602
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
604 603
       <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" />
604
+        <state relative-caret-position="300">
605
+          <caret line="20" column="0" lean-forward="false" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
607 606
           <folding />
608 607
         </state>
609 608
       </provider>
610 609
     </entry>
610
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
611
+      <provider selected="true" editor-type-id="text-editor">
612
+        <state relative-caret-position="450">
613
+          <caret line="32" column="32" lean-forward="false" selection-start-line="32" selection-start-column="32" selection-end-line="32" selection-end-column="32" />
614
+          <folding />
615
+        </state>
616
+      </provider>
617
+    </entry>
618
+    <entry file="file://$PROJECT_DIR$/pom.xml">
619
+      <provider selected="true" editor-type-id="text-editor">
620
+        <state relative-caret-position="187">
621
+          <caret line="11" column="10" lean-forward="false" selection-start-line="11" selection-start-column="10" selection-end-line="11" selection-end-column="10" />
622
+          <folding />
623
+        </state>
624
+      </provider>
625
+    </entry>
626
+    <entry file="file://$PROJECT_DIR$/src/main/java/LifeStarts.java" />
627
+    <entry file="file://$PROJECT_DIR$/src/main/java/Life.java" />
611 628
     <entry file="uml://JAVA/com.zipcodeconway.ConwayGameOfLife">
612 629
       <provider selected="true" editor-type-id="UmlEditorProvider">
613 630
         <state>
@@ -629,64 +646,62 @@
629 646
         </state>
630 647
       </provider>
631 648
     </entry>
632
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md">
633
-      <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 />
638
-          </first_editor>
639
-          <second_editor />
649
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
650
+    <entry file="file://$USER_HOME$/Downloads/ConwayLifeRandomat50.png" />
651
+    <entry file="file://$USER_HOME$/Documents/gitea/gitea/custom/public/img/ConwayLifeUML.png" />
652
+    <entry file="file://$PROJECT_DIR$/src/main/java/GameofLife.java" />
653
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/GetNeighbors.java">
654
+      <provider selected="true" editor-type-id="text-editor">
655
+        <state relative-caret-position="60">
656
+          <caret line="4" column="4" lean-forward="true" selection-start-line="4" selection-start-column="4" selection-end-line="4" selection-end-column="4" />
657
+          <folding />
640 658
         </state>
641 659
       </provider>
642 660
     </entry>
643
-    <entry file="file://$USER_HOME$/Downloads/ConwayLifeRandomat50.png">
644
-      <provider selected="true" editor-type-id="images">
645
-        <state />
661
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/Neighbors.java">
662
+      <provider selected="true" editor-type-id="text-editor">
663
+        <state relative-caret-position="150">
664
+          <caret line="10" column="0" lean-forward="true" selection-start-line="10" selection-start-column="0" selection-end-line="10" selection-end-column="0" />
665
+          <folding />
666
+        </state>
646 667
       </provider>
647 668
     </entry>
648
-    <entry file="file://$USER_HOME$/Documents/gitea/gitea/custom/public/img/ConwayLifeUML.png">
669
+    <entry file="file://$PROJECT_DIR$/ConwayLifeRandomat50.png">
649 670
       <provider selected="true" editor-type-id="images">
650 671
         <state />
651 672
       </provider>
652 673
     </entry>
653
-    <entry file="file://$PROJECT_DIR$/src/main/java/GameofLife.java">
674
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
654 675
       <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" />
676
+        <state relative-caret-position="165">
677
+          <caret line="13" column="2" lean-forward="true" selection-start-line="13" selection-start-column="2" selection-end-line="13" selection-end-column="2" />
657 678
           <folding />
658 679
         </state>
659 680
       </provider>
660 681
     </entry>
661
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
682
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/Cell.java">
662 683
       <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>
684
+        <state relative-caret-position="0">
685
+          <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="2" selection-end-line="45" selection-end-column="3" />
686
+          <folding />
668 687
         </state>
669 688
       </provider>
670 689
     </entry>
671 690
     <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
672 691
       <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>
692
+        <state relative-caret-position="223">
693
+          <caret line="18" column="25" lean-forward="true" selection-start-line="18" selection-start-column="25" selection-end-line="18" selection-end-column="25" />
694
+          <folding />
682 695
         </state>
683 696
       </provider>
684 697
     </entry>
685
-    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
698
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java">
686 699
       <provider selected="true" editor-type-id="text-editor">
687 700
         <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" />
689
-          <folding />
701
+          <caret line="35" column="41" lean-forward="true" selection-start-line="35" selection-start-column="41" selection-end-line="35" selection-end-column="41" />
702
+          <folding>
703
+            <element signature="imports" expanded="true" />
704
+          </folding>
690 705
         </state>
691 706
       </provider>
692 707
     </entry>

BIN
Screen Shot 2018-03-12 at 8.42.34 PM.png Прегледај датотеку


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

@@ -1,11 +1,24 @@
1 1
 package com.zipcodeconway;
2 2
 
3 3
 public class ConwayGameOfLife {
4
+    int[][] currentGeneration;
5
+    int[][] nextGeneration;
6
+
7
+    public SimpleWindow displayWindow;
4 8
 
5 9
     public ConwayGameOfLife(Integer dimension) {
6
-     }
10
+        currentGeneration = createRandomStart(dimension);
11
+        nextGeneration = new int[dimension][dimension];
12
+        displayWindow = new SimpleWindow(dimension);
13
+
14
+    }
7 15
 
8 16
     public ConwayGameOfLife(Integer dimension, int[][] startmatrix) {
17
+        currentGeneration = startmatrix;
18
+        nextGeneration = new int[dimension][dimension];
19
+        displayWindow = new SimpleWindow(dimension);
20
+
21
+
9 22
     }
10 23
 
11 24
     public static void main(String[] args) {
@@ -17,16 +30,43 @@ public class ConwayGameOfLife {
17 30
     // Which cells are alive or dead in generation 0.
18 31
     // allocates and returns the starting matrix of size 'dimension'
19 32
     private int[][] createRandomStart(Integer dimension) {
20
-        return new int[1][1];
33
+        int[][] randomStart = new int[dimension][dimension];
34
+        for (int row = 0; row < dimension; row++) {
35
+            for (int col = 0; col < dimension; col++) {
36
+                randomStart[row][col] = (int) (Math.random() * 2);
37
+            }
38
+        }
39
+        return randomStart;
21 40
     }
22 41
 
23 42
     public int[][] simulate(Integer maxGenerations) {
24
-        return new int[1][1];
43
+        int generations = 0;
44
+        while (generations <= maxGenerations) {
45
+            this.displayWindow.display(currentGeneration, generations);
46
+
47
+            for (int row = 0; row < currentGeneration.length; row++) {
48
+                for (int col = 0; col < currentGeneration.length; col++) {
49
+                    nextGeneration[row][col] = isAlive(row, col, currentGeneration);
50
+                }
51
+            }
52
+
53
+            copyAndZeroOut(nextGeneration, currentGeneration);
54
+            this.displayWindow.sleep(125);
55
+            generations++;
56
+        }
57
+
58
+        return currentGeneration;
25 59
     }
26 60
 
27 61
     // copy the values of 'next' matrix to 'current' matrix,
28 62
     // and then zero out the contents of 'next' matrix
29
-    public void copyAndZeroOut(int [][] next, int[][] current) {
63
+    public void copyAndZeroOut(int[][] next, int[][] current) {
64
+        for (int row = 0; row < current.length; row++) {
65
+            for (int col = 0; col < current.length; col++) {
66
+                current[row][col] = next[row][col];
67
+                next[row][col] = 0;
68
+            }
69
+        }
30 70
     }
31 71
 
32 72
     // Calculate if an individual cell should be alive in the next generation.
@@ -38,6 +78,46 @@ public class ConwayGameOfLife {
38 78
 		Any dead cell with exactly three live neighbours cells will come to life.
39 79
 	*/
40 80
     private int isAlive(int row, int col, int[][] world) {
41
-        return 0;
81
+         int up = row -1;
82
+         int down = row + 1;
83
+         int right = col + 1;
84
+         int left = col -1;
85
+
86
+        int amountOfNeighborsAlive = 0;
87
+//        Cell cell = new Cell(row, col);
88
+        int lifeDeathValue = world[row][col];
89
+
90
+        if (up < 0){
91
+            up = world[row].length -1;
92
+        }
93
+        if (down == world[row].length){
94
+            down = 0;
95
+        }
96
+        if (right == world[col].length){
97
+            right = 0;
98
+        }
99
+        if (left < 0){
100
+            left = world[col].length -1;
101
+        }
102
+
103
+
104
+        if (world[down][right] > 0) amountOfNeighborsAlive++;
105
+        if (world[down][left] > 0) amountOfNeighborsAlive++;
106
+        if (world[up][left] > 0) amountOfNeighborsAlive++;
107
+        if (world[up][right] > 0) amountOfNeighborsAlive++;
108
+        if (world[row][left] > 0) amountOfNeighborsAlive++;
109
+        if (world[row][right] > 0) amountOfNeighborsAlive++;
110
+        if (world[down][col] > 0) amountOfNeighborsAlive++;
111
+        if (world[up][col] > 0) amountOfNeighborsAlive++;
112
+
113
+        if (amountOfNeighborsAlive> 3 || amountOfNeighborsAlive < 2) {
114
+            lifeDeathValue =  0;
115
+        } else if (lifeDeathValue == 0 && amountOfNeighborsAlive == 3) {
116
+            lifeDeathValue = 1;
117
+        }
118
+        return lifeDeathValue; // only returns a one a zero
42 119
     }
120
+
43 121
 }
122
+
123
+

+ 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.BLACK);
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.PINK);
47 47
                     g.fillRect(i * BOX_DIM, j * BOX_DIM, 10, 10);
48 48
                 }
49 49
             }