Tuesday, March 26, 2019

Jordan-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


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)

# Your Code Here
def countdown(n) :
print("Jeopardy the game[game reset]")
for count in time:
count=count+1
n=10
for player1Button == "HIGH":
break
player1LED input(HIGH)
player2Button=("LOW")
player3Button=("LOW")
player4Button=("LOW")
print("player 1, answer the question. You have 10 seconds.")
while n>0:
n=n-1
countdown(1)
print (n, "second(s) left")
if n==0:
break
print("time's up!")
print("Game over, reset")
if alexResetButton = "HIGH"
break


Today I worked on the code for the jeopardy project with Anthony. We started on
a copy-able template to use for every player. I don't know if this works, so tomorrow
I will work on it with Andrew.

No comments:

Post a Comment