AdInf Dev Journals #1: RPS

AdInf Dev Journals #1: RPS

Games Mentioned

  • RPS
  • Doomsday Everyday

Currently there are two projects being planned for:

RPS which stands for rock, paper, scissors is a simple Python game that is currently in production and Doomsday Everyday which will be much larger in scale and time-horizon. The steps the that I have planned for completing the RPS project are:

Key: Completed In-progress/Pending

  • Created a python script that:
    • Only allows a user input of “r”, “p”, “s”, or “” . If input is blank a random choice will be selected.
    • Accepts capital letters.
    • Picks a random choice for the computer and determines win, tie, or defeat.
  • Implementing:
    • GUI for user to input and see the output
    • Properly maintains win/tie/lose even in cases of error
    • Allow for “fully-auto mode” CPU vs CPU
    • Allow for play to choose “exit” or “continue” that triggers or halts a while loop
  • Later:
    • Allow user to send a code to play against their friend!
    • Graphic design

Here’s what I have so far:

https://www.online-python.com/RgZYn14Lvh

from pickle import TRUE
import re
import random
import sys
from argparse import FileType
FileType = ".py"

#input (user choice)
rps = ["r", "p", "s" , "R", "P", "S"]

CONT = TRUE
while CONT == TRUE:
    userchoice = input("Rock (r), paper (p), or scissors (s)?:  ")

    if userchoice not in rps:
        print("Error! Only letters r, p, s allowed")
        continue

    elif len(userchoice) > 1:
        print("Error! Only 1 character allowed")
        continue
    tie_count= 0
    win_count=0
    lose_count=0

    UC = str(userchoice).lower()
    cpu = rps[random.randint(0, 2)]

    #matchups
    if UC == cpu:
        tie_count+=1
        print("Tie!")
        print("Your input was:", UC)
        print("Computer choice was:", cpu)
        c = input("Continue? (Enter) or Quit (q)?")
        if c = ""

    elif UC == "r" and cpu == "s" or UC == "s" and cpu == "p" or UC== "p" and cpu == "r":
        win_count+=1
        print("Winner!")
        print("Your input was:", UC)
        print("Computer choice was:", cpu)
        c = input("Continue? (Enter) or Quit (q)?")

    elif UC == "r" and cpu == "p" or UC == "s" and cpu == "r" or UC== "p" and cpu == "s":
        lose_count+=1
        print("Loser!")
        print("Your input was:", UC)
        print("Computer choice was:", cpu)
        c = input("Continue? (Enter) or Quit (q)?")

    
print("goodbye!")

That’s all for today, will expand upon code and documentation tomorrow. prioritizing figuring out how to implement a Python terminal embed and how to get inputs to auto enter

,

2 responses to “AdInf Dev Journals #1: RPS”

Leave a comment