43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright © 2024 Simon Forman
|
|
#
|
|
# This file is part of game
|
|
#
|
|
# game is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# game is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with game. If not see <http://www.gnu.org/licenses/>.
|
|
#
|
|
from random import randint, expovariate, seed
|
|
from data import save
|
|
from poisson import poisson
|
|
|
|
|
|
MINIMUM_DISTANCE_BETWEEN_STARS = 160
|
|
WIDTH, HEIGHT = 10240, 7680
|
|
|
|
|
|
seed(23)
|
|
|
|
print('Generating data.')
|
|
state = dict(
|
|
width = WIDTH,
|
|
height = HEIGHT,
|
|
stars = {
|
|
(x, y): round(1 + expovariate(1))
|
|
for x, y in poisson(WIDTH, HEIGHT, MINIMUM_DISTANCE_BETWEEN_STARS)
|
|
},
|
|
)
|
|
|
|
print('Saving game.state')
|
|
save('game.state', state)
|