Wednesday, March 27, 2019

Jordan Fronko-PM-Open Lab- Jeopardy Code

# Jeopardy Controller
# 3.3v = 1,17, 5.0v =2,4 GND = 6,9,14,20,25,30,34,39
# I/O = 3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,
# More I/O =26,27,28,29,31,32,33,35,36,37,38,40

import RPi.GPIO as GPIO
from time import sleep
import random
import time
n=10
count=0

GPIO.setmode(GPIO.BOARD)
alexResetButton = 18
alexStartTimerButton = 22
readyLED = 5
player1LED = 7
player2LED = 8
player3LED = 10
player4LED = 11
player1Button = 12
player2Button = 13
player3Button = 15
player4Button = 16

GPIO.setup(readyLED, GPIO.OUT)
GPIO.setup(player1LED, GPIO.OUT)
GPIO.setup(player2LED, GPIO.OUT)
GPIO.setup(player3LED, GPIO.OUT)
GPIO.setup(player4LED, GPIO.OUT)
GPIO.setup(alexResetButton, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(alexStartTimerButton, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(player1Button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(player2Button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(player3Button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(player4Button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
list.Answerbucket[]
Answerbucket.append["He loves to build walls, but hasn't built one yet."]
Answerbucket.append["He is America's Uncle whom makes the most money off you."]
Answerbucket.append["She was born on January 7, 2092","Give me a break of that."]
list.players()
# Your Code Here
def countdown(n) :
if count==0:
players.append[p1]
players.append[p2]
players.append[p3]
players.append[p4]
 print("Jeopardy the game[game reset]")
  if GPIO.output(22,True)
    print("Answer time!",(random.choice(Answerbucket)))
    for count in time:#what is this for? #the timer? I think
      count=count+1
      countup(1)
      print (count, "second(s) left")
#this loop will turn off all of the buttons and turn on the LED for the button that was pressed
      for b in "p1":
        players.remove[p2]
        players.remove[p3]
        players.remove[p4]
        GPIO.output(7,True)
        print("player 1, what is the question to",Answerbucket,"? You have 10 seconds.")
        sleep(.13)
        print("3....")
        sleep(1)
        print("2....")
        sleep(1)
        print('1!')
        while n>0:
          n=n-1
          GPIO.output(7,True)
          countdown(1)
          print (n, "second(s) left")
          GPIO.output(7,False)
          if GPIO.output(12,True):
            break
            if n==0:
              print("Time's up!")
              delay(.1)
              print("let's go again")
              break
while True:
while resetButtonState == False:
  resetButtonState = GPIO.input(alexResetButton)
  if alexResetButton = True:
    GPIO.output(player1LED,False)
    GPIO.output(player2LED,False)
    GPIO.output(player1LED,False)
    GPIO.output(player1LED,False)
    player1Button = False
    player2Button = False
    player3Button = False
    player4Button = False
    n=10
    count=0

today during open lab I worked on the Jeopardy project code. I plan on fine-tuning the player section of code so i can copy-paste them to the rest of the player code. Tomorrow i want to work on the end and beginning as well.

No comments:

Post a Comment