diff --git a/app.yaml b/app.yaml index 77ef50f..5bbea8f 100644 --- a/app.yaml +++ b/app.yaml @@ -6,7 +6,7 @@ instance_class: F4_1G entrypoint: gunicorn -t 120 --log-level debug -b :$PORT main:app env: flex threadsafe: yes -max_concurrent_requests: 2 +max_concurrent_requests: 1 resources: cpu: 2 diff --git a/main.py b/main.py index 4444dc8..b2497a0 100644 --- a/main.py +++ b/main.py @@ -41,7 +41,7 @@ def story_request(): phrase = request.form["phrase"] gen_actions = request.form["actions"] # given prompt - print("\n Given prompt is: \n",prompt,"\n") + print("\n Given prompt is: \n",prompt," ", phrase,"\n") generator = get_generator() diff --git a/static/script.js b/static/script.js index f49d0c4..182da21 100644 --- a/static/script.js +++ b/static/script.js @@ -1,4 +1,4 @@ -initial_prompt = "You enter a dungeon with your trusty sword and shield. You are searching for the evil necromancer who killed your family. You believe he is at the lowest level of the dungeon. You know you will encounter undead zombies and skeletons. You enter the first door and see" +initial_prompt = "You enter a dungeon with your trusty sword and shield. You are searching for the evil necromancer who killed your family. You've heard that he resides at the bottom of the dungeon, guarded by legions of the undead. You enter the first door and see" start_text = "Adventurer@AIDungeon:~$ ./EnterDungeon \n
" @@ -53,9 +53,21 @@ var StoryTracker = { acceptInput = true if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { - inputStr = window.prompt("sometext","defaultText"); - StoryTracker.processInput() + setTimeout(StoryTracker.mobileButton, 1000); } + + } + + }, + + mobileButton:function(){ + + if (Typer.index >= Typer.text.length -1){ + inputStr = window.prompt("What is your choice?","0"); + StoryTracker.processInput() + } + else{ + setTimeout(StoryTracker.mobileButton, 1000); } }, @@ -89,6 +101,7 @@ var StoryTracker = { StoryTracker.lastAction = StoryTracker.actions[choice_int] StoryTracker.lastStory = StoryTracker.results[choice_int] StoryTracker.makeActionRequests(StoryTracker.firstStory + StoryTracker.lastStory) + Typer.appendToText("\n\n") Typer.appendToText(StoryTracker.lastStory) Typer.appendToText("\n\nOptions:") } @@ -97,6 +110,11 @@ var StoryTracker = { Typer.appendToText("Invalid choice. Must be a number from 0 to 3. \n") Typer.appendToText("\nWhich action do you choose? ") acceptInput=true + + if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { + setTimeout(StoryTracker.mobileButton, 1000); + } + }