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

Coding a game, variable with more values?

chipsomoviemaking
1#
chipsomoviemaking Published in 2017-12-06 16:28:21Z

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("",pos27,pos28,pos29,pos30,"D",pos6,pos7,pos8,pos9)
print("",pos26,"D D D X D D D",pos10)
print("",pos25,pos24,pos23,pos22,"D",pos11,pos12,pos13,pos14)
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.332827 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO