Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text Based Game
#1
I am a complete noob and old to boot, I have created some code that will give the user 2 chances to get the correct answer, if they are wrong 2 times, a HINT will print to the terminal due to a nested while loop, I would like to give them 2 more chances, then give them the ANSWER, I cannot get an additional nested while loop to work, please help an old guy. Maybe another nested while loop is not what is required?? Wrong is a global code declared at the top of the game, along with Correct (not used in this type of multiple answer question 'a' thru 'g'). Wdo 10, python 3.

    wrngCnt = 0

    q2a = input('Construct the minimal BOILER PLATE HTML Template answer NOW: \n\n')
    if q2a == '<!DOCTYPE html>':
        time.sleep(1)
    while q2a != '<!DOCTYPE html>':
        print(wrong)
        q2a = input()                   #Waiting for the user to input the correct answer again
        while wrngCnt < 1:
            wrngCnt = wrngCnt + 1
            print('')
            print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
            print('HINT: This line of code requires the HTML5 tag, no indent.)
            print('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
            print('')
    q2b()
Hope the tags are working, this is the first question 'a' thru 'g' to allow the user to type into the terminal the minimal boiler plate that I previously taught in a tutorial within the game, if we can make 'a' work, I can get the next 1000 questions to work, thanks in advance for any assistance.
Reply


Messages In This Thread
Text Based Game - by DuaneJack - Aug-14-2018, 01:35 AM
RE: Text Based Game - by ichabod801 - Aug-14-2018, 12:59 PM
RE: Text Based Game - by DuaneJack - Aug-15-2018, 04:57 AM
RE: Text Based Game - by ichabod801 - Aug-15-2018, 12:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Game - Choice Based theor 4 8,369 May-22-2024, 01:17 PM
Last Post: alanbriggs
  Text-Based RPG - After selecting correct decision it also prints others code KimJiwoo1 1 1,751 Apr-26-2023, 08:30 PM
Last Post: deanhystad
  Complete beginnner making a text based adventure Mishmaccles 2 3,538 Jul-07-2021, 05:00 PM
Last Post: BashBedlam
  Adding an inventory and a combat system to a text based adventure game detkitten 2 9,771 Dec-17-2019, 03:40 AM
Last Post: detkitten
  Using classes for room movement (text game) Lawr3y 3 8,350 Aug-20-2019, 12:40 AM
Last Post: Lawr3y
  Text Game Testing/Dev PKMindBlow 21 14,387 Feb-05-2018, 11:04 PM
Last Post: PKMindBlow

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020