Add map generator

dev
Alfred Melch 5 years ago
parent aee29baad0
commit bca41f2231

@ -1,4 +1,7 @@
from flask import Flask
import json
from flask import Flask, jsonify
from .lib import generate_map
app = Flask(__name__)
@ -6,3 +9,13 @@ app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World'
@app.route('/generate')
def generate():
return jsonify(generate_map(10, 8))
@app.route('/generate/<int:x>/<int:y>')
def generate_var(x, y):
return jsonify(generate_map(x, y))

@ -0,0 +1,7 @@
import random
TERRAIN_TYPES = [0, 1, 2, 3]
def generate_map(x_len, y_len):
return [[random.choice(TERRAIN_TYPES) for y in range(y_len)] for x in range(x_len)]

@ -1,2 +1,4 @@
flask==1.1.1
python-dotenv==0.10.3
python-dotenv==0.10.3
autopep8==1.4.4
pylint==2.4.4
Loading…
Cancel
Save