[Tutor] 1 to 49 numbered grid
boB Stepp
robertvstepp at gmail.com
Thu Dec 8 09:51:28 EST 2016
Greetings!
On Thu, Dec 8, 2016 at 4:00 AM, M Ali <MAli6 at dixonsaa.com> wrote:
>
> I was wondering if you can help me, as I am struggling to create a numbered grid in Python. I am trying to be able to create a snakes and ladders game in Python and it must have a numbered grid and involve 2 players. I would appreciate it if you can help me or guide me to create this game.
There are plenty of people here ready and willing to help. However,
you will need to be much more specific on where you are stuck.
Normally you should clearly state the problem you are trying to solve,
show the code relevant to your problem that you have written (copy and
paste), give any error tracebacks in full (copy and paste), state what
you were trying to do and what you expected, etc. It is also usually
helpful to state what version of Python you are using and your
operating system. Be forewarned: We will *not* do your homework for
you. You need to show effort and we will help you when you get stuck.
As to what little you said, if you are printing your grid of numbers
to a terminal window, perhaps using triple quotes might be helpful?
Suppose you wanted a big number one:
print("""
__
/ |
|
|
|
|
___|___
""")
You could do things like set a variable equal to such a string. For
instance you can replace the print() with "one =" and put your
triple-quoted string here. You could do the same with variables two,
three, ... , nine. This might give you more flexibility down the
line. For instance you could have a dictionary of big numbers based
on doing this that might correlate with your grid numbers. As for
your grid you could do similar things, break your grid boxes into
repeating tiles and store these elements in a suitable variable to
reuse as needed. I am being very general here, but perhaps this can
give you some ideas.
HTH!
--
boB
More information about the Tutor
mailing list