From 6087be61a54761aab8a9312d69f4cc47a0e36d21 Mon Sep 17 00:00:00 2001 From: Nick Walton Date: Thu, 11 Apr 2019 21:02:17 -0600 Subject: [PATCH] custoM --- main.py | 20 ++++++++++++++++---- static/script.js | 11 ++++++++--- templates/index.html | 3 +++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 041c0cc..fba0dd8 100644 --- a/main.py +++ b/main.py @@ -88,15 +88,27 @@ def generate_action_result(prompt, phrase): return action, action_result - - + @app.route('/') def root(): - return render_template('index.html') + seed = -1 + data = {'seed': seed} + return render_template('index.html', data=data) + + +@app.route('/') +def rootseed(seed): + if seed == "": + seed = -1 + else: + seed = int(seed) + data = {'seed': seed} + return render_template('index.html', data=data) @app.route('/index.html') def index(): - return render_template('index.html') + data = {'seed': -1} + return render_template('index.html', data=data) @app.route('/about.html') def about(): diff --git a/static/script.js b/static/script.js index 571191e..0a455aa 100644 --- a/static/script.js +++ b/static/script.js @@ -13,9 +13,14 @@ var should_blink = false var blinkCounter = 0 var action_list = ["You attack", "You tell", "You use", "You go"] var prompt_num = 0 -var seed_max = 1000 -var seed_min = 0 -var seed = Math.floor(Math.random() * (+seed_max - +seed_min)) + +seed_min; +var seed_max = 100 +var seed_min = 0; + +if(seed == -1){ + var seed = Math.floor(Math.random() * (+seed_max - +seed_min)) + +seed_min; +} + + //var seed = 999 console.log("Seed is ", seed) diff --git a/templates/index.html b/templates/index.html index 69cee5e..6159914 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,6 +3,9 @@ Dungeon +