def test_roll_dm(self): '''Die: Test roll DM''' rolls = [] die6 = Die(6) for _ in range(0, NUM_TESTS): rolls.append(die6.roll(1, -2)) # dm = -2 for roll in rolls: self.assertTrue(roll in range(-1, 5))
def test_roll_ceiling(self): '''Die: Test roll ceiling()''' rolls = [] die6 = Die(6) for _ in range(0, NUM_TESTS): rolls.append(die6.roll(1, ceiling=4)) for roll in rolls: self.assertTrue(roll in range(1, 5))
def test_roll_floor(self): '''Die: Test roll floor()''' rolls = [] die6 = Die(6) for _ in range(0, NUM_TESTS): rolls.append(die6.roll(1, floor=3)) for roll in rolls: self.assertTrue(roll in range(3, 7))
def test_roll(self): '''Die: Test roll results''' rolls = [] die6 = Die(6) for _ in range(0, NUM_TESTS): rolls.append(die6.roll(1)) print(rolls) for roll in rolls: self.assertTrue(roll in range(1, 7))
def __init__(self, system): # Expose system objects self.system = system self.mainworld = self.system.mainworld self.stellar = self.system.stellar self.importance_x = self.system.importance_x self.economic_x = self.system.economic_x self.cultural_x = self.system.cultural_x # Useful objects made available here to # avoid explicit imports in descendants self.d6 = Die(6) self.d3 = Die(3) self.d100 = Die(100) self.pseudohex = Pseudohex self.table = Table self.uwp = uwp
import logging import json import re from random import randint, seed from T5_worldgen.pseudohex import Pseudohex from T5_worldgen.util import Die, Flux, Table from T5_worldgen.trade_codes import TradeCodes from T5_worldgen.planet import Planet from T5_worldgen.star import Primary import T5_worldgen.upp as uwp LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.ERROR) D3 = Die(3) D6 = Die(6) FLUX = Flux() class System(object): '''Return a T5 basic system with the specified name and location hex''' naval_base_presence = Table() naval_base_presence.add_row('A', 6) naval_base_presence.add_row('B', 5) scout_base_presence = Table() scout_base_presence.add_row('A', 4) scout_base_presence.add_row('B', 5) scout_base_presence.add_row('C', 6)
'''planet module''' import logging import json import T5_worldgen.upp as uwp from T5_worldgen.util import Die, Table, Flux from T5_worldgen.trade_codes import TradeCodes LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.ERROR) D6 = Die(6) D3 = Die(3) FLUX = Flux() class Planet(object): '''Planet object''' starport_table = Table() starport_table.add_row((2, 4), 'A') starport_table.add_row((5, 6), 'B') starport_table.add_row((7, 8), 'C') starport_table.add_row((9), 'D') starport_table.add_row((10, 11), 'E') starport_table.add_row(12, 'X') starport_table.dice = 2 spaceport_table = Table() spaceport_table.add_row((0), 'Y')
'''star module''' import logging import json from T5_worldgen.util import Die, Flux, Table LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.CRITICAL) D2 = Die(2) D5 = Die(5) D6 = Die(6) D10 = Die(10) FLUX = Flux() class _Star(object): '''Star base class''' # Spectral type spectral_type_table = Table() spectral_type_table.add_row(-6, 'OB') spectral_type_table.add_row((-5, -4), 'A') spectral_type_table.add_row((-3, -2), 'F') spectral_type_table.add_row((-1, 0), 'G') spectral_type_table.add_row((1, 2), 'K') spectral_type_table.add_row((3, 5), 'M') spectral_type_table.add_row((6, 8), 'BD') size_o_table = Table() size_o_table.add_row((-6, -5), 'Ia')