Kibret Tecle před 6 roky
rodič
revize
0ff6ac0de8

+ 30
- 30
.idea/workspace.xml Zobrazit soubor

@@ -3,6 +3,7 @@
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="e282cee1-bfe9-42a3-9794-9633eb4654d1" name="Default" comment="">
5 5
       <change beforePath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" afterPath="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
6
+      <change beforePath="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" afterPath="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
6 7
     </list>
7 8
     <ignored path="$PROJECT_DIR$/target/" />
8 9
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -18,7 +19,7 @@
18 19
     </SUITE>
19 20
   </component>
20 21
   <component name="FileEditorManager">
21
-    <splitter split-orientation="horizontal" split-proportion="0.63804716">
22
+    <splitter split-orientation="horizontal" split-proportion="0.5682657">
22 23
       <split-first>
23 24
         <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
24 25
           <file leaf-file-name="SimpleWindow.java" pinned="false" current-in-tab="false">
@@ -36,8 +37,8 @@
36 37
           <file leaf-file-name="ConwayGameOfLife.java" pinned="false" current-in-tab="true">
37 38
             <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
38 39
               <provider selected="true" editor-type-id="text-editor">
39
-                <state relative-caret-position="390">
40
-                  <caret line="26" column="45" lean-forward="true" selection-start-line="26" selection-start-column="45" selection-end-line="26" selection-end-column="45" />
40
+                <state relative-caret-position="1470">
41
+                  <caret line="98" column="33" lean-forward="false" selection-start-line="98" selection-start-column="15" selection-end-line="98" selection-end-column="33" />
41 42
                   <folding />
42 43
                 </state>
43 44
               </provider>
@@ -57,8 +58,8 @@
57 58
           <file leaf-file-name="ConwayGameOfLifeTest.java" pinned="false" current-in-tab="true">
58 59
             <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
59 60
               <provider selected="true" editor-type-id="text-editor">
60
-                <state relative-caret-position="855">
61
-                  <caret line="60" column="0" lean-forward="false" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
61
+                <state relative-caret-position="615">
62
+                  <caret line="44" column="55" lean-forward="false" selection-start-line="44" selection-start-column="55" selection-end-line="44" selection-end-column="55" />
62 63
                   <folding />
63 64
                 </state>
64 65
               </provider>
@@ -107,8 +108,8 @@
107 108
         <option value="$PROJECT_DIR$/src/main/java/Life.java" />
108 109
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/SimpleWindow.java" />
109 110
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/README.md" />
110
-        <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
111 111
         <option value="$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java" />
112
+        <option value="$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java" />
112 113
       </list>
113 114
     </option>
114 115
   </component>
@@ -356,7 +357,7 @@
356 357
       <envs />
357 358
       <patterns />
358 359
     </configuration>
359
-    <configuration name="ConwayGameOfLifeTest.testIsAlive2" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
360
+    <configuration name="ConwayGameOfLifeTest.testNumberOfLiveGetNeignbours" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
360 361
       <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
361 362
         <pattern>
362 363
           <option name="PATTERN" value="com.zipcodeconway.*" />
@@ -368,7 +369,7 @@
368 369
       <option name="ALTERNATIVE_JRE_PATH" />
369 370
       <option name="PACKAGE_NAME" value="com.zipcodeconway" />
370 371
       <option name="MAIN_CLASS_NAME" value="com.zipcodeconway.ConwayGameOfLifeTest" />
371
-      <option name="METHOD_NAME" value="testIsAlive2" />
372
+      <option name="METHOD_NAME" value="testNumberOfLiveGetNeignbours" />
372 373
       <option name="TEST_OBJECT" value="method" />
373 374
       <option name="VM_PARAMETERS" value="-ea" />
374 375
       <option name="PARAMETERS" />
@@ -464,19 +465,19 @@
464 465
     </configuration>
465 466
     <list size="6">
466 467
       <item index="0" class="java.lang.String" itemvalue="Maven.ConwayLife" />
467
-      <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testIsAlive2" />
468
-      <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
469
-      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
470
-      <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
471
-      <item index="5" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
468
+      <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
469
+      <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
470
+      <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
471
+      <item index="4" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
472
+      <item index="5" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testNumberOfLiveGetNeignbours" />
472 473
     </list>
473 474
     <recent_temporary>
474 475
       <list size="5">
475 476
         <item index="0" class="java.lang.String" itemvalue="Application.ConwayGameOfLife" />
476 477
         <item index="1" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest" />
477
-        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
478
-        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
479
-        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testIsAlive2" />
478
+        <item index="2" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.testNumberOfLiveGetNeignbours" />
479
+        <item index="3" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest3" />
480
+        <item index="4" class="java.lang.String" itemvalue="JUnit.ConwayGameOfLifeTest.runTest1" />
480 481
       </list>
481 482
     </recent_temporary>
482 483
   </component>
@@ -494,7 +495,7 @@
494 495
       <option name="presentableId" value="Default" />
495 496
       <updated>1519668901598</updated>
496 497
       <workItem from="1519668902904" duration="14517000" />
497
-      <workItem from="1520801916382" duration="36937000" />
498
+      <workItem from="1520801916382" duration="37411000" />
498 499
     </task>
499 500
     <servers />
500 501
   </component>
@@ -520,8 +521,8 @@
520 521
     <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 21h 32m 48s.xml">
521 522
       <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
522 523
     </history-entry>
523
-    <history-entry file="ConwayGameOfLifeTest_runTest1 - 2018.03.12 at 19h 39m 46s.xml">
524
-      <configuration name="ConwayGameOfLifeTest.runTest1" configurationId="JUnit" />
524
+    <history-entry file="ConwayGameOfLifeTest - 2018.03.12 at 21h 46m 01s.xml">
525
+      <configuration name="ConwayGameOfLifeTest" configurationId="JUnit" />
525 526
     </history-entry>
526 527
     <history-entry file="ConwayGameOfLifeTest_runTest3 - 2018.03.12 at 19h 42m 29s.xml">
527 528
       <configuration name="ConwayGameOfLifeTest.runTest3" configurationId="JUnit" />
@@ -531,24 +532,23 @@
531 532
     </history-entry>
532 533
   </component>
533 534
   <component name="TimeTrackingManager">
534
-    <option name="totallyTimeSpent" value="51454000" />
535
+    <option name="totallyTimeSpent" value="51928000" />
535 536
   </component>
536 537
   <component name="ToolWindowManager">
537 538
     <frame x="-213" y="-1080" width="1920" height="1080" extended-state="0" />
538
-    <editor active="true" />
539 539
     <layout>
540 540
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
541 541
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
542
-      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32718447" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
542
+      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.326713" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
543 543
       <window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
544 544
       <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
545 545
       <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
546 546
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
547 547
       <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
548
-      <window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2747573" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
548
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2747573" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
549 549
       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
550 550
       <window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3297568" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
551
-      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.22746186" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
551
+      <window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22718446" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
552 552
       <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
553 553
       <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
554 554
       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.13125" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
@@ -664,18 +664,18 @@
664 664
         </state>
665 665
       </provider>
666 666
     </entry>
667
-    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
667
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
668 668
       <provider selected="true" editor-type-id="text-editor">
669
-        <state relative-caret-position="855">
670
-          <caret line="60" column="0" lean-forward="false" selection-start-line="60" selection-start-column="0" selection-end-line="60" selection-end-column="0" />
669
+        <state relative-caret-position="1470">
670
+          <caret line="98" column="33" lean-forward="false" selection-start-line="98" selection-start-column="15" selection-end-line="98" selection-end-column="33" />
671 671
           <folding />
672 672
         </state>
673 673
       </provider>
674 674
     </entry>
675
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/zipcodeconway/ConwayGameOfLife.java">
675
+    <entry file="file://$PROJECT_DIR$/src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java">
676 676
       <provider selected="true" editor-type-id="text-editor">
677
-        <state relative-caret-position="390">
678
-          <caret line="26" column="45" lean-forward="true" selection-start-line="26" selection-start-column="45" selection-end-line="26" selection-end-column="45" />
677
+        <state relative-caret-position="615">
678
+          <caret line="44" column="55" lean-forward="false" selection-start-line="44" selection-start-column="55" selection-end-line="44" selection-end-column="55" />
679 679
           <folding />
680 680
         </state>
681 681
       </provider>

+ 2
- 2
src/main/java/com/zipcodeconway/ConwayGameOfLife.java Zobrazit soubor

@@ -85,7 +85,7 @@ public class ConwayGameOfLife {
85 85
 		Any dead cell with exactly three live neighbours cells will come to life.
86 86
 	*/
87 87
     public int isAlive(int row, int col, int[][] world) {
88
-        int neighbours = getNeighbours(row, col, world);
88
+        int neighbours = getNeighboursALive(row, col, world);
89 89
 
90 90
         //test
91 91
         if (neighbours == 2)
@@ -96,7 +96,7 @@ public class ConwayGameOfLife {
96 96
             return 0;
97 97
     }
98 98
 
99
-    public int getNeighbours(int row, int col, int[][] input) {
99
+    public int getNeighboursALive(int row, int col, int[][] input) {
100 100
         int totalNeighbors = 0;
101 101
         int index = 0;
102 102
         for (int i = -1; i <= 1; i++) {

+ 5
- 5
src/test/java/com/zipcodeconway/ConwayGameOfLifeTest.java Zobrazit soubor

@@ -21,7 +21,7 @@ public class ConwayGameOfLifeTest {
21 21
     }
22 22
     @Test
23 23
     public void testIsAlive2(){
24
-        ConwayGameOfLife x=new ConwayGameOfLife(5);
24
+        ConwayGameOfLife test=new ConwayGameOfLife(5);
25 25
         int[][] start = {
26 26
                 {0, 0, 0, 0, 0},
27 27
                 {0, 0, 1, 0, 0},
@@ -29,12 +29,12 @@ public class ConwayGameOfLifeTest {
29 29
                 {0, 0, 1, 0, 0},
30 30
                 {0, 0, 0, 0, 0}};
31 31
         int expected =1;
32
-        int actual = x.isAlive(2,2,start);
32
+        int actual = test.isAlive(2,2,start);
33 33
         Assert.assertEquals(expected,actual);
34 34
     }
35 35
     @Test
36 36
     public void testNumberOfLiveGetNeignbours(){
37
-        ConwayGameOfLife x=new ConwayGameOfLife(5);
37
+        ConwayGameOfLife test=new ConwayGameOfLife(5);
38 38
         int[][] start = {
39 39
                 {0, 0, 0, 0, 0},
40 40
                 {0, 0, 1, 0, 0},
@@ -42,8 +42,8 @@ public class ConwayGameOfLifeTest {
42 42
                 {0, 0, 1, 0, 0},
43 43
                 {0, 0, 0, 0, 0}};
44 44
         int expected =2;
45
-        //int actual = x.getneighbours(x.getNeighbours(3,3,start));
46
-        //Assert.assertEquals(expected,actual);
45
+        int actual = test.getNeighboursALive(3,3,start);
46
+        Assert.assertEquals(expected,actual);
47 47
     }
48 48
     @Test
49 49
     public void testGetNeignbours(){