So I was looking around the web and I found they made a Pokemon batch file game. The idea got me thinking and I would like to create my own Pokemon game with Python. I'm currently learning Python and I know Batch Programming. so in able to get some practice I also want to make another game with python called Rock, Paper, Scissors, Lizard, Spock (Big Bang Theory reference yes I know). There is source code online for Rock, Paper, Scissors, Lizard, Spock is online so I'm going to try this first and make my own custom tweaks (I was thinking adding a insult option so it can possibly change the probability of landing on rock, paper, so on so on. Also, insulting the game so much it will exit lol.) The Pokemon game will take a while so I plan to posts updates on it periodically.
So first up is the Rock, Paper, Scissors, Lizard, Spock game 😁. I will be trying to finish this up here within a couple of months. I work a lot so free time is scarce. Any suggestions on what else would be cool to add to this would be greatly appreciated.
Mar 8, 2016 09:00 AM
(This post was last modified: Mar 10, 2016 03:11 PM by Goodies.)
Yeah, I don't know the actual rules of the game, so I'll just do it with normal rock, paper, scissors, or just give you the general idea.
This does t take into account scoring or ties or anything. This is just a base thing.
Thank you Goodies 😉 I'll definitely have use for this. I'll try tinkering with this tonight. 😁
Mar 10, 2016 03:11 PM
(This post was last modified: Mar 10, 2016 03:11 PM by Goodies.)
I wrote that on my phone so I never tested it. Here's a better (working) version:
PHP Code
<?php class rps: def __init__(self, name, beats): self.beats = beats self.name = name
def __gt__(self, other): return any([isinstance(other, x) for x in self.beats])
def __str__(self): return self.name
class rock(rps): def __init__(self): super(rock, self).__init__("Rock", [scissors])
class paper(rps): def __init__(self): super(paper, self).__init__("Paper", [rock])
class scissors(rps): def __init__(self): super(scissors, self).__init__("Scissors", [paper])
r = rock() p = paper() s = scissors()
from itertools import product for x,y in product([r, p, s], repeat=2): print("{} beats {} = {}".format(x, y, x > y))
Output:
Code Rock beats Rock = False
Rock beats Paper = False
Rock beats Scissors = True
Paper beats Rock = True
Paper beats Paper = False
Paper beats Scissors = False
Scissors beats Rock = False
Scissors beats Paper = True
Scissors beats Scissors = False
Tried to post but the forum kept blocking my post... saying that something triggered the blocking feature of the forum 😶 ......oooook? Well here's my workaround for that.
http://pastebin.com/v2KutwGB
I really want to make a exit option with this and possibly keep score... also when the computer decides it shows some ascii of a hand doing the option it chooses.
(Mar 11, 2016 03:29 AM)killcode567 Wrote: Tried to post but the forum kept blocking my post... saying that something triggered the blocking feature of the forum 😶 ......oooook? Well here's my workaround for that.
http://pastebin.com/v2KutwGB
I really want to make a exit option with this and possibly keep score... also when the computer decides it shows some ascii of a hand doing the option it chooses.
I mean, a bunch of if statements togetheris kind of indicative of bad OOP, especially when classes are so much easier and extensible...
Mar 11, 2016 04:55 PM
(This post was last modified: Mar 12, 2016 08:15 AM by killcode567.)
Since I'm new at programming could you show me how you apply my code with classes so I can see what you mean? I'm more of a visual learner. The setup I got is the way I want it seen on the output... but any improvements you could show me i would be very grateful.
I find it easier to work with some code I find then modify it so I can get the jist of the commands that's how I've learned batch.
(Mar 11, 2016 09:51 AM)Goodies Wrote: I mean, a bunch of if statements togetheris kind of indicative of bad OOP, especially when classes are so much easier and extensible...
I've been watching classes on YouTube for classes to try to understand... I can see what you mean about using classes making it easier but I'm going to have to fiddle around with it more to get it the way I want. I'll post here again when I've come up with something...
Some revisions have been made. It almost works the way I want it. You can say fuck you to the game and it will insult you and shut off.
http://pastebin.com/wRATNkEN
Still working out things but it seems to function nicely. Will continue on working on it... I know when I have the thing set for random insults sometimes it shuts off... trying to fix this.
Next step if making a function. Don't directly dive into classes, they're scary in the beginning.
GL!
Jul 6, 2016 07:02 PM
(This post was last modified: Jul 7, 2016 12:19 AM by killcode567.)
Revised version of my game:
http://pastebin.com/nTfefymA
Revised my code and got my faces to be variables... issue is they don't come up the way it's suppose to it's all jumbled compared just using the print commands 😑 Can anyone give me advice on how to fix this?
working on functions. Learning more on youtube
fixed it!!! 🤗
http://pastebin.com/iip5r8Dv
still working on functions.
Code Revision #2
http://pastebin.com/iQ3cfhz3
Feels like I keep jumping around thinking of new things... trying to figure out how to put this in classes is kinda confusing for me... I did add a feature where you can put your name in it and it'll greet you and say welcome to my rock, paper, scissors, lizard, Spock game 😁 also trying to consider functions... I had no idea this would turn out so good lol. I hope I can finish this soon so I can work on my next project.
Jul 27, 2016 07:15 AM
(This post was last modified: Jul 27, 2016 07:25 AM by killcode567.)
(Mar 10, 2016 03:11 PM)Goodies Wrote: I wrote that on my phone so I never tested it. Here's a better (working) version:
Code class rps:
def __init__(self, name, beats):
self.beats = beats
self.name = name
def __gt__(self, other):
return any([isinstance(other, x) for x in self.beats])
def __str__(self):
return self.name
class rock(rps):
def __init__(self):
super(rock, self).__init__("Rock", [scissors])
class paper(rps):
def __init__(self):
super(paper, self).__init__("Paper", [rock])
class scissors(rps):
def __init__(self):
super(scissors, self).__init__("Scissors", [paper])
r = rock()
p = paper()
s = scissors()
from itertools import product
for x,y in product([r, p, s], repeat=2):
print("{} beats {} = {}".format(x, y, x > y))
[/code]
Output:
Code Rock beats Rock = False
Rock beats Paper = False
Rock beats Scissors = True
Paper beats Rock = True
Paper beats Paper = False
Paper beats Scissors = False
Scissors beats Rock = False
Scissors beats Paper = True
Scissors beats Scissors = False
Messed around with Goodies code to give classes another try so I tried rewriting it a bit. I think I'm starting to get this a little more I've been trying to learn even more on python. Been using an app on my phone to learn it while on my breaks at work and been watching courses online to familiarize myself with everything.
Code class rps:
def __init__(self, name, beats):
self.beats = beats
self.name = name
def __gt__(self, other):
return any([isinstance(other, x) for x in self.beats])
def __str__(self):
return self.name
class rock(rps):
def __init__(self):
super(rock, self).__init__("Rock", [scissors,lizard])
class paper(rps):
def __init__(self):
super(paper, self).__init__("Paper", [rock,spock])
class scissors(rps):
def __init__(self):
super(scissors, self).__init__("Scissors", [paper,lizard])
class lizard(rps):
def __init__(self):
super(lizard, self).__init__("Lizard", [spock,paper])
class spock(rps):
def __init__(self):
super(spock, self).__init__("Spock", [rock,scissors])
r = rock()
p = paper()
s = scissors()
l = lizard()
sp = spock()
from itertools import product
for x,y in product([r, p, s,l,sp], repeat=2):
print("{} beats {} = {}".format(x, y, x > y))
Output:
Code Rock beats Rock = False
Rock beats Paper = False
Rock beats Scissors = True
Rock beats Lizard = True
Rock beats Spock = False
Paper beats Rock = True
Paper beats Paper = False
Paper beats Scissors = False
Paper beats Lizard = False
Paper beats Spock = True
Scissors beats Rock = False
Scissors beats Paper = True
Scissors beats Scissors = False
Scissors beats Lizard = True
Scissors beats Spock = False
Lizard beats Rock = False
Lizard beats Paper = True
Lizard beats Scissors = False
Lizard beats Lizard = False
Lizard beats Spock = True
Spock beats Rock = True
Spock beats Paper = False
Spock beats Scissors = True
Spock beats Lizard = False
Spock beats Spock = False
Haven't been on as much as I used to so I figured I'd update on progress. My Rock, paper, Scissors, Lizard, Spock game is still in development because I'm stuck on rewriting it with classes. I decided to write another game using classes for a RPG text based game to learn about it better (following tutorials on YouTube). I'm currently using Python 3.5.2 and when I wrote this game I used Python 3.4.3 (it still works fine even when I updated my Python). I also learned a few new things like os.system() to call for certain things from the OS. I've also been taking courses through Sololearn. I'll post my source code here if anyone is interested in it. I would like to learn how to equip my weapons on the thing but that I'm still learning and sadly the guy has not posted another video to do it lol I'm trying.
link to my RPG text based game:
http://pastebin.com/4nkVSR12
If anyone can help me with the equipping of my OH SHIT! Sword so it adds to my base attack I'd be incredibly grateful 😁
I just want to say I have followed tutorials on youtube and here is the guy I'm learning it from. the link for the tutorials are below:
RPG Tutorial for Python
Idk what version of Python he has because he's using something called cloud9 but using my Python I will say I had issues using raw_input() and print among other issues.
|