changeset 115:ef63532cac13

Rearrange SCIENCE a bit.
author Jeremy Thurgood <firxen@gmail.com>
date Wed, 09 May 2012 23:10:29 +0200
parents 0cdd13622355
children a8a46c14d467
files gamelib/lab.py gamelib/research.py gamelib/schematics.py gamelib/tests/test_lab.py run_visualization.py
diffstat 4 files changed, 72 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/lab.py	Wed May 09 23:03:45 2012 +0200
+++ b/gamelib/lab.py	Wed May 09 23:10:29 2012 +0200
@@ -43,9 +43,13 @@
             if schematic.STARTING_PRODUCT:
                 self._gain_science(schematic())
 
-        # We get three random sciences with no prerequisites.
-        new_science = []
-        for _ in range(3):
+        # We start with Physics, because it's not Philately.
+        physics = research.Physics()
+        self._gain_science(physics)
+        new_science = [physics]
+
+        # We get two other random sciences with no prerequisites.
+        for _ in range(2):
             science = choice(self.find_new_research())()
             self._gain_science(science)
             new_science.append(science)
--- a/gamelib/research.py	Wed May 09 23:03:45 2012 +0200
+++ b/gamelib/research.py	Wed May 09 23:10:29 2012 +0200
@@ -5,36 +5,70 @@
     SCIENCE_TYPE = 'research'
 
 
-class Tesla(ResearchArea):
-    NAME = "Tesla"
-
-
-class Robotics(ResearchArea):
-    NAME = "Robotics"
-
-
-class Rocketry(ResearchArea):
-    NAME = "Rocketry"
-
-
-class Biogenetics(ResearchArea):
-    NAME = "Biogenetics"
+class Physics(ResearchArea):
+    NAME = "Physics"
 
 
 class Psychology(ResearchArea):
     NAME = "Psychology"
 
 
-class Fusion(ResearchArea):
-    NAME = "Fusion"
+class MedicalExperiments(ResearchArea):
+    NAME = "Medical Experiments"
+
+
+class Meteorology(ResearchArea):
+    NAME = "Meteorology"
 
 
-class Medical(ResearchArea):
-    NAME = "Medical Experiments"
+class Biogenetics(ResearchArea):
+    NAME = "Biogenetics"
+    PREREQUISITES = (
+        (MedicalExperiments, 2),
+        )
+
+
+class Oceanography(ResearchArea):
+    NAME = "Oceanography"
+    PREREQUISITES = (
+        (Physics, 1),
+        (Meteorology, 1),
+        )
 
 
 class Lasers(ResearchArea):
     NAME = "Lasers"
+    PREREQUISITES = (
+        (Physics, 2),
+        )
+
+
+class Fusion(ResearchArea):
+    NAME = "Fusion"
+    PREREQUISITES = (
+        (Physics, 10),
+        )
+
+
+class Electrickery(ResearchArea):
+    NAME = "Electrickery"
+    PREREQUISITES = (
+        (Physics, 1),
+        )
+
+
+class Rocketry(ResearchArea):
+    NAME = "Rocketry"
+    PREREQUISITES = (
+        (Physics, 3),
+        )
+
+
+class Robotics(ResearchArea):
+    NAME = "Robotics"
+    PREREQUISITES = (
+        (Electrickery, 3),
+        )
 
 
 class Space(ResearchArea):
@@ -45,6 +79,14 @@
         )
 
 
+class MarineBiology(ResearchArea):
+    NAME = "Marine Biology"
+    PREREQUISITES = (
+        (Biogenetics, 2),
+        (Oceanography, 2),
+        )
+
+
 class ArtificialIntelligence(ResearchArea):
     NAME = "Artificial Intelligence"
     PREREQUISITES = (
--- a/gamelib/schematics.py	Wed May 09 23:03:45 2012 +0200
+++ b/gamelib/schematics.py	Wed May 09 23:10:29 2012 +0200
@@ -85,7 +85,7 @@
     COST = 300
     CATEGORIES = (cat.HAND_WEAPON,)
     PREREQUISITES = (
-        (research.Tesla, 1),
+        (research.Electrickery, 1),
         )
 
 
@@ -94,7 +94,7 @@
     COST = 1000
     CATEGORIES = (cat.VEHICLE,)
     PREREQUISITES = (
-        (research.Tesla, 3),
+        (research.Electrickery, 3),
         )
 
 
--- a/gamelib/tests/test_lab.py	Wed May 09 23:03:45 2012 +0200
+++ b/gamelib/tests/test_lab.py	Wed May 09 23:10:29 2012 +0200
@@ -6,9 +6,9 @@
 
 LAB_DATA = {
     'science': {
-        'research.Robotics': 1,
+        'research.Physics': 5,
         'research.Rocketry': 2,
-        'research.Tesla': 3,
+        'research.Electrickery': 3,
         },
     }
 
@@ -34,7 +34,7 @@
     def test_find_new_research(self):
         lab = Lab(LAB_DATA)
         new_research = lab.find_new_research()
-        self.assertTrue(research.Space in new_research)
+        self.assertTrue(research.Lasers in new_research)
         self.assertTrue(research.ArtificialIntelligence not in new_research)
 
     def test_save_data(self):