You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def textonum(a):
if a == 'a':
ttnoutput = 1
if a == 'b':
ttnoutput = 2
if a == 'c':
ttnoutput = 3
if a == 'd':
ttnoutput = 4
if a == 'e':
ttnoutput = 5
if a == 'f':
ttnoutput = 6
if a == 'g':
ttnoutput = 7
if a == 'h':
ttnoutput = 8
if a not in (1,2,3,4,5,6,7,8):
print('does not fit number')
print(a)
def postoval(c): #1-64 not 0-63
textonum(c[0])
ptvoutput = (ttnoutput) + (int(c[1])-1)*8
print(ttnoutput+(int(c[1])-1)*8) #ive tried printing it out and its working
ptvoutput = ttnoutput+(int(c[1])-1)*8 setting it into the variable twice but name error bounces out using that variable
Bug report
Bug description:
#chess
#init
ttnoutput = 1 #this shouldnt be here but just for testing. it doesnt work normally without this either
list=['R','N','B','K','Q','B','N','R',
'P','P','P','P','P','P','P','P',
'.','.','.','.','.','.','.','.',
'.','.','.','.','.','.','.','.',
'.','.','.','.','.','.','.','.',
'.','.','.','.','.','.','.','.',
'p','p','p','p','p','p','p','p',
'r','n','b','k','q','b','n','r']
lastmove = 'e2e4'
All functions
def showb():
showcount = 0
while showcount != 64:
showcount1 = (showcount + 1)/8 -1 + 1
showcount2 = ' '+str(showcount1)
if showcount+1 in (8,16,24,32,40,48,56,64):
print(list[showcount], end=showcount2+'\n')
else:
print(list[showcount], end=' ')
showcount += 1
def textonum(a):
if a == 'a':
ttnoutput = 1
if a == 'b':
ttnoutput = 2
if a == 'c':
ttnoutput = 3
if a == 'd':
ttnoutput = 4
if a == 'e':
ttnoutput = 5
if a == 'f':
ttnoutput = 6
if a == 'g':
ttnoutput = 7
if a == 'h':
ttnoutput = 8
if a not in (1,2,3,4,5,6,7,8):
print('does not fit number')
print(a)
def initvars():
initpos = lastmove[0,2]
finalpos = lastmove[2,4]
textonum(initpos[0])
def postoval(c): #1-64 not 0-63
textonum(c[0])
ptvoutput = (ttnoutput) + (int(c[1])-1)*8
print(ttnoutput+(int(c[1])-1)*8) #ive tried printing it out and its working
ptvoutput = ttnoutput+(int(c[1])-1)*8 setting it into the variable twice but name error bounces out using that variable
def legal_move():
pass
def move(d,b):
postoval(d)
opos = ptvoutput
postoval(b)
fpos = ptvoutput
if list(opos-1) != '.':
print('Cannot move no piece')
else:
list[fpos-1] = list[opos-1]
list[opos-1] = '.'
Code starts here
showb()
move('e2','e4')
CPython versions tested on:
3.11
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: