AdInf Dev Journals #2
Games Mentioned
- RPS
Sites Mentioned
- WAMO
Today I am working on two projects, RPS, my rock paper scissors game explained in Journal #1 and finishing a calculator for WAMO.
WAMO, which stands for What Are My Odds (whataremyodds.app) is my site for calculating personalized odds of different events. An example on an event on the site is being struck by lightning. The odds of being struck by lightning is on average in ~ 1 in 6 million, however if you are someone who is never outside in the rain and doesn’t live in an area with thunderstorms your odds are definitely lower than that. Situations like this are the keystone reason for WAMO’s existence.
Currently, I am working on my third calculator and article for the site. The calculators are quite simple and just require me to edit an HTML template that I have already created, figure out factors affecting odds of event occurrence, and figure out the already existing average in order to keep the calculator from. The article part also take some time but is more about graphic design and properly summarizing information.
The action items I have completed and plan to work on for RPS today:
Key: Completed In-progress/Pending
- Created a python script that:
- Properly maintains win/tie/lose even in cases of error
- Allows for “fully-auto mode” CPU vs CPU
- Allows for player to choose “exit” or “continue” that triggers or halts a while loop
- Implementing:
- GUI for user to input and see the output
- Code revisions
- Later:
- Allow user to send a code to play against their friend!
- Graphic design
Here’s what I have so far:
Click Run… when I figure out how embed terminals on wordpress haha
#import, keeping it barebones and crosscompatible
from pickle import FALSE, TRUE
import re
import random
import sys
from argparse import FileType
FileType = ".py"
#allowed character list and initializing counts
rps = ["r", "p", "s" , "R", "P", "S" , ""]
tie_count= 0
win_count=0
lose_count=0
c = TRUE
while c == TRUE:
userchoice = input("Rock (r), paper (p), scissors (s), or random (Enter)??: ")
print(userchoice)
if userchoice not in rps:
print("Error! Only letters r, p, s allowed")
continue
elif len(userchoice) > 1:
print("Error! Only 1 character max allowed")
continue
if userchoice == "":
userchoice = rps[random.randint(0, 2)]
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)
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)
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)
#continue/quit
cont = input("Continue? (Enter) or Quit (q)?")
if cont == "q":
c = FALSE
print("goodbye!")
print("\n Wins:" , win_count, "\n Loses:" , lose_count, "\n Ties:" , tie_count)
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 properly host
2 responses to “AdInf Dev Journals #2: WAMO”
[…] this weekend I worked on two of my projects: RPS (Rock Paper Scissors) and WAMO (link to […]
LikeLike
[…] Over this weekend I worked on two of my projects: RPS (Rock Paper Scissors) and WAMO. […]
LikeLike