Ask coding questions

← Back to all posts
I need help...
JordanDixon1 (299)

So, Repl community. I would like to say: Hi. Anyway, down to business.

I am having trouble with my latest project, I need an extra hand to help me with it. The project is the card game known as: Trash.

The way it works is every player is given 2 sets of 5 cards face down. The 1st player then draws a card from the deck and replaces one of the face down cards. for example if I draw an ace then the top left card I can replace if it is face down, other wise I'll have to put it in the trash pile which any person can take and use instead of drawing from the normal deck.

Anyway, the way to win in replacing all of your face down cards. Then (if you guys wanna keep playing) Everyone starts over and the person that one gets one card less.

I need help actually making this in python.

Answered by Highwayman (1251) [earned 5 cycles]
View Answer
Commentshotnewtop
Highwayman (1251)

How so? You seem to have plenty implemented already.. what specifically can we help you with?

JordanDixon1 (299)

@Highwayman I need help with the replacing the card. I need it to be where if I replace a card and if the card I got after replacing can be replaced then I can replace again, however I can't because I need a loop but I don't really know how to do that. I just need help developing the app a little X3

Highwayman (1251)

@JordanDixon1 it’s not a loop, but it might clear things for you (recursion seems to make more sense)

def replace(str):
  if replaceable:
    # replace stuff
    return replace(str)
  else:
    return str
JordanDixon1 (299)

@Highwayman Ok, so where would I implement this? I want it to be where if I played and then if its not replacable then it goes into the "Trash pile" and any player can get it. If it also not replacable then it is the next player's turn. (There's a lot of stuff I need help with that's why I need a coding buddy to help me. I'll invite you to the repl if you want to help.)

Highwayman (1251)

@JordanDixon1
Where if I played...
It looks like you already answered your own question...

I would join, but I haven’t actually coded in python in quite a while and all I really have is some basic syntax in my back pocket (I can’t seem to remember exactly how the import keyword works).