im a beginner at comp science, and my prof is using python, which is totally new tom me i had a few questions with the program im writing, im having a few problems.
brief summary
i have to do a project where there are nine boxes filled with number 1-8, and 1 space is empty, the game needs to be scrambled, also all the moves need to be saved. the game can be paused anytime during thegame. the object is to move the numbers into the black spot till they are all in order.
the grid i have needs to contain variables so that can be moved by the players
this what i have and i know it is far off
def board():
board = [1,2,3,4,5,6,7,8,9]
for x in range(0, 9):
print "|"
if(board[x]==9):
print "_"
else:
print board[x]
if(x==8):
print "|"
board()
when i run that it looks like this
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
_
|
and this is how i need it to look:
|1|2|3|
|4|5|6|
|7|8|_|
what am i doing wrong? also how do i use the random.shuffle() function so i can scramble the numbers?
help would be greatly appriciated...
also how would i save every move, also the random fuction isnt working so i can scramble the numbers.