Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,422 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,3 +59,4 @@ target/ | |
|
||
.DS_Store | ||
bin/map_*.png | ||
bin/export*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var JSONStream = require('JSONStream'); | ||
var fs = require('fs'); | ||
|
||
var fileName = 'export.json'; | ||
var fd = fs.openSync(fileName, 'r'); | ||
var readStream = fs.createReadStream(fileName); | ||
var fileSize = fs.fstatSync(fd)['size']; | ||
console.log('File size: ', fileSize); | ||
|
||
var place = 0; | ||
|
||
readStream | ||
.on('data', function (chunk) { | ||
console.log(Math.round(place / fileSize * 100) / 100 + '%'); | ||
place += chunk.length; | ||
}) | ||
.pipe(JSONStream.parse('hexes.*')) | ||
.on('data', function(data) { | ||
//console.dir(this); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
|
||
pressure zonal changes | ||
|
||
| zone | season | pressure | | ||
|-------|--------|----------| | ||
| land | winter | high | | ||
| | summer | low | | ||
| ocean | | ||
|
||
|
||
seasons | ||
|
||
| hemisphere | end year | mid year | | ||
|------------|----------|----------| | ||
| northern | winter | summer | | ||
| southern | summer | winter | | ||
|
||
|
||
ITCZ changes | ||
|
||
mid_year = move north | ||
end_year = move south | ||
|
||
max range of movement: | ||
ocean 5 degrees | ||
land 40 degrees |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import math | ||
import random | ||
|
||
class Month: | ||
|
||
def __init__(self, ordinal, num_days, day_length): | ||
self.ordinal = ordinal | ||
self.num_days = num_days | ||
self.day_length = day_length | ||
|
||
def __repr__(self): | ||
return "<Month ordinal={} " \ | ||
"num_days={} " \ | ||
"day_length={}>".format(self.ordinal, self.num_days, self.day_length) | ||
|
||
|
||
class Calendar: | ||
|
||
def __init__(self, year_length, day_length, month_length_target=None): | ||
self.year_length = year_length | ||
self.day_length = day_length | ||
|
||
self.months = [] | ||
|
||
# determine the number of months | ||
# split the year_length into twelve months with an integer number of days | ||
# each month should have around 30 days | ||
if month_length_target is None: | ||
if year_length > 35: | ||
month_length_target = random.randint(25, 35) | ||
else: | ||
month_length_target = year_length / 2 | ||
# print("Target length of month: {}".format(month_length_target)) | ||
|
||
found_month_number = year_length | ||
while(math.floor(year_length / found_month_number) < month_length_target): | ||
num_months = found_month_number | ||
found_month_number -= 1 | ||
# print("Number of months: {}".format(num_months)) | ||
even_split = year_length / num_months | ||
# print("Length of each month if split evenly: {}".format(even_split)) | ||
|
||
days_left = year_length | ||
even_split = math.floor(even_split) | ||
for num in range(1, num_months + 1): | ||
# print(days_left, '-', even_split, days_left - even_split, '<', 0) | ||
if days_left - even_split < even_split: | ||
num_days = days_left | ||
else: | ||
num_days = even_split | ||
self.months.append( Month(num, num_days, day_length) ) | ||
days_left -= even_split | ||
|
||
# print('total', sum([x.num_days for x in self.months])) | ||
|
||
# | ||
# import pprint | ||
# pp = pprint.PrettyPrinter(indent=4) | ||
# echo = pp.pprint | ||
# | ||
# def generate_calendar(len_year, len_day): | ||
# """ | ||
# len_year = (int) length of year in Earth days | ||
# len_day = (int) length of day in Earth hours | ||
# """ | ||
# print("Generating calendar") | ||
# calendar = Calendar(len_year, len_day) | ||
# echo(calendar.months) | ||
# return calendar | ||
# | ||
# | ||
# generate_calendar(365, 24) | ||
# generate_calendar(231, 34) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.