Browse Source

cutting some if statements

Trinh Tong 6 years ago
parent
commit
5972560798
2 changed files with 3 additions and 6 deletions
  1. 1
    1
      .idea/workspace.xml
  2. 2
    5
      src/main/java/com/zipcodeconway/ConwayGameOfLife.java

+ 1
- 1
.idea/workspace.xml View File

236
   <component name="PropertiesComponent">
236
   <component name="PropertiesComponent">
237
     <property name="WebServerToolWindowFactoryState" value="false" />
237
     <property name="WebServerToolWindowFactoryState" value="false" />
238
     <property name="aspect.path.notification.shown" value="true" />
238
     <property name="aspect.path.notification.shown" value="true" />
239
-    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542848238278" />
239
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542954631305" />
240
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
240
     <property name="com.intellij.testIntegration.createTest.CreateTestDialog.defaultLibrary" value="JUnit4" />
241
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
241
     <property name="last_opened_file_path" value="$PROJECT_DIR$" />
242
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
242
     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />

+ 2
- 5
src/main/java/com/zipcodeconway/ConwayGameOfLife.java View File

81
         int count = neighbors(row, col, world);
81
         int count = neighbors(row, col, world);
82
         int returnValue = 0;
82
         int returnValue = 0;
83
 
83
 
84
-        if (count == 3) {
85
-            returnValue = 1;
86
-        }
87
-        if (world[row][col] == 1 && count == 2){
84
+        if (count == 3 || (world[row][col] == 1 && count == 2)) {
88
             returnValue = 1;
85
             returnValue = 1;
89
         }
86
         }
90
 
87
 
111
                     j = 0;
108
                     j = 0;
112
                 }
109
                 }
113
 
110
 
114
-                if (world[i][j] == 1 &&(!(i == row && j == col))) {
111
+                if (world[i][j] == 1 && (!(i == row && j == col))) {
115
                     count++;
112
                     count++;
116
                 }
113
                 }
117
 
114