Hello Guys,

i am new to python, for a assingment i need to create a game (binary puzzle).
im having problems to start with creating the bord, i saw some examples of creating a bord game on this forum but it didnt worked out for me.

i want to create a bord like this.

a player need to enter a "1" or "0" by entering coordinates like B4 1.

i tryed to create a board but came up with this

col = 6
row = 6

bord = []
for i in range(6):
  bord.append([""]*col)


print(bord[0])
print(bord[1])
print(bord[2])
print(bord[3])
print(bord[4])
print(bord[5])

i was trying to create a bord size of 6b6, but i here i miss the A,B,C and the numbers.

and i also want to create a function that a player would be able to create a bord by entering a number as size.
do i need to start with this ? or can i make a gameboard and then make this function.

Recommended Answers

All 3 Replies

In this well known page about Sudoku Click Here, Peter Norvig draws boards of numbers in a console simply by printing convenient strings of characters. Try to print one of his boards, it should give you ideas for your own boards.

since im new to programming and python its hard for me to follow his steps.
his board is different aswell, and this one is different from sudoku.
i dont want to print a board of numbers, just a board with. a player can enter 1 or 0 by entering a coordinate.

There are no steps to follow, you can start by printing

board = """
4 . . |. . . |8 . 5 
. 3 . |. . . |. . . 
. . . |7 . . |. . . 
------+------+------
. 2 . |. . . |. 6 . 
. . . |. 8 . |4 . . 
. . . |. 1 . |. . . 
------+------+------
. . . |6 . 3 |. 7 . 
5 . . |2 . . |. . . 
1 . 4 |. . . |. . . 
"""
print(board)

Then adapt it to your case by replacing the numbers by 0s and 1s, change the position of the horizontal and vertical lines.

Once it looks the way you want, print it then print it row by row, then think about incorporating the user's move in the game.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.