Home Coding a game, variable with more values?
Reply: 0

Coding a game, variable with more values?

user1181 Published in March 24, 2018, 12:30 am

I'm trying to code a game that resembles "ludo". It's very similar but play ground actually looks like this: https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Menschenaergern.svg/250px-Menschenaergern.svg.png

This is how play ground is being printed:

print("      ",pos1,pos2,pos3)
print("      ",pos32, "D",pos4)
print("      ",pos31, "D",pos5)
print("",pos26,"D D D X D D D",pos10)
print("      ",pos21, "D",pos5)
print("      ",pos20, "D",pos5)
print("      ",pos19,pos18,pos17)

Before this print function, I have defined all these variables from pos1 to pos32 to be *. It looks like a regular playground.

Everything works fine except that after a player A throws a dice, his position gets bigger according to the number he threw, for example: position = position + throw. What I need to do, is next time it prints the board (playground), it should show the player with his new position. I'm not sure how to link his current position to the variables. Any ideas? Thanks in adv ance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.327733 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO