I'm trying to make this game (pseudo code below) And I have no way to go about doing it.


The game will have 30 trivia questions, and the player will have 3 lives


When they get the answer correct, they will move on, and if they got all questions correct the unlock the elite four questions and after those they gamne is completed.
When they get the answer wrong they lose alife and after 3 lives the game will be over and they arerompted to retry the quiz

The questions will be based on

-The Anime
-The Game
-Name of Poke'mon
-What Poke'mon evolves into, if evolves
-Conditions for evolution
-Where Poke'mon can be found
-Legendary Poke'mon

Menu System

1-Start Poke'Trivia
2-Quit
3-About Poke'Trivia


1: Start the 30 questions quiz
2: Exit the Poke'Trivia

Thanks in advance

Recommended Answers

All 9 Replies

sounds like you want someone to write it for you. If not, there's a sticky post near the top of the python section that details graphical user interface programming for python beginners.

Thanks, I wasn't looking for someone to do it for me, just wanted some tips on how to get started. Or at the very least get some rough estimates, on how difficult this project will be.

Someone told me this might chalk up a couple hours of my time at the most. I have no problem with that of course, I always have plenty of time on my hands.

I'm more so stumped as reference to title, rather than lazy and unwilling.

I have the:
Python
Programming,
Second Edition

for the absolute beginner

At my fingertips presently, but as I have no idea where to start i'm not sure where to go about looking in the booklet. There may be something i'm missing, but as far as I know of theres no example programs that cover this.

Any advice is appreciated and helpful.

This along or instead of the Pseudo Code should have been my first post, because that's what someone said to me in another forum.

Well, my first recommendation is to look at nested if statements. At least, that's the first thing that jumps out at me. If you wanted you could make a few functions that would handle the subtraction of lives if they get something wrong. nextQuestion might handle a range of questions if you wanted it to?

if (question):
   nextQuestion
else
  checkLives
  nextQuestion

There may be an easier, cleaner way to do it in python, but it is early in the morning.

hey there dude, it should be relatively simple,
like the one above me said your if statements, are the place to start.
remember write your program out on paper in pseudo code, first, then convert it to proper code and then code it, this is a winning step by step, guide to writing a program.

:) reply if any more ?s

Wait.

Have you actually learned how to program with python yet, or are you hoping to just pull this one out of your butt?

Wait.

Have you actually learned how to program with python yet, or are you hoping to just pull this one out of your butt?

Yes, I took a class in school called BCP, we did our games in python, and now that i'm my own im trying to:

1. Make sure I remember the stuff I learned
2. Create a game to help build upon my knowledge.

Im trying to do the things I didn't learn in school, like the trivia game for example.

I know what I want to do, I just need a little help getting there. That's why I posted here.

We didnt go down to the bare bone of python, we were given a power point, assaignment on the power point, and that's alll.

We only dabbled in graphics and sound near the last days of the course.

I know how to do simple text based games, which is all we did for the longest time but that is as far as my knowledge goes.

And once again im here to take it further, I've set my mind on this game as a first, but I don't where to start first.

I'm trying to make this game (pseudo code below)

You never posted your psuedo code.

I suggest starting with a 'Hello World' program that maybe prints a menu and asks the user for their input.

Next, I would work on a question/answer function that is ambiguous and can pick from a dictionary of questions and answers.

Finally, I would implement the 'turns' and 'lives' of the player.

Thanks you guys have been helpful, im going to attempt to code it today and I will post back later on my progress.

Wether Im having success, or problems and such. I will also check the sticky ihatehippie's mentioned previously.

import pygame
from pygame.locals import *
import random

questions = ["Who is the Poke Prof. In Red Blue and Yellow", "What is the final evolved form of Charmander?", "Do you like mudkipz?", "What Poke'mon do you find in the cerulean city cave?", "What is the final battle to becoming a Poke'mon champion?","Who is your rival in Red Blue and Yellow", "Who are the recurring villians in the Poke'mon Games?", "What Poke'mon type does Lance Use?", "Who many badges must your player collect?", "Do you like this quiz?"]
answers ={"Who is the Poke Prof. In Red Blue and Yellow":["Professor Oak", "Professor Birch", "Professor Tree"],
           "What is the final evolved form of Charmander?":["Charizard", "Blastoise", "Torchic"],
           "Do you like mudkipz?":["Yes i liek Mudkipz", "Mudkipz?", "Yes I like Mudkips"],
          "What Poke'mon do you find in the cerulean city cave?":["Mewtwo", "Mew", "Brock"],
          "What is the final battle to becoming a Poke'mon champion?":["Elite 4", "Grand Battle Ultra", "Poke Playoffs"],
          "Who is your rival in Red Blue and Yellow":["Gary", "Mr.5", "Bulbasaur"],
          "Who are the recurring villians in the Poke'mon Games?":["Team Rocket", "Koga", "Koffing"],
          "What Poke'mon type does Lance Use?":["Dragon Type", "Fire Type", "Water Type"],
          "Who many badges must your player collect?":["8", "5", "6"],
          "Do you like this quiz?":["Yes","I love you!", "mudkipz!"]}
             
                   
                   
def rand_sort(l):
   new = []
   while len(new) != len(l):
       pick = random.choice(l)
       while pick in new:
           pick = random.choice(l)
       new.append(pick)
   return new

class QuestionEngine(object):
   def __init__(self):
       self.current_question = 0
       self.lives = 3

       self.won = False
       self.lost = False

       self.current_answer_order = rand_sort(answers[questions[self.current_question]])

   def test_answer(self, answer):
       x = self.current_answer_order[answer]
       if answers[questions[self.current_question]].index(x) == 0:
           self.current_question += 1
           if self.current_question >= len(questions):
               self.won = True
               self.current_answer_order = []
           else:
               self.current_answer_order = rand_sort(answers[questions[self.current_question]])
           return True
       self.lives -= 1
       if self.lives <= 0:
           self.lost = True
       return False

   def get_question_and_answers(self):
       if not self.won:
           x = questions[self.current_question]
           return x, self.current_answer_order
       return None, None


def main():
    
   qe = QuestionEngine()

   while 1:
       if qe.won:
           print "-->Congrats...Your a Poke'mon master!"
           return
       if qe.lost:
           print "-->Your out of Poke'mon"
           return

       q, a = qe.get_question_and_answers()
       print "-->lives:", qe.lives
       print

       print "Question:", q
       print "Answers:"
       for i in xrange(len(a)):
           print "\t%s:"%i, a[i]

       answer = raw_input("Your answer*%s-%s? "%(0, len(a)-1))
       try:
           int(answer)
       except:
           print "you can do better than that!"
           continue

       if qe.test_answer(int(answer)):
           print "-->You are Evolving!.. To the Next stage!"
       else:
           print "-->It was super effective!"

main()

That's the quiz portion, i'm now looking do do a py game window

640x480

And have a background image for each question.

Suggestions, tips, or examples on how I might go about this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.