Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables not being set in defines #111030

Closed
hablahblahha opened this issue Oct 18, 2023 · 1 comment
Closed

Variables not being set in defines #111030

hablahblahha opened this issue Oct 18, 2023 · 1 comment

Comments

@hablahblahha
Copy link

hablahblahha commented Oct 18, 2023

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

@hablahblahha hablahblahha added the type-bug An unexpected behavior, bug, or error label Oct 18, 2023
@hugovk
Copy link
Member

hugovk commented Oct 18, 2023

You've not said what the problem is, I'm guessing it's a bug in your code. This issue tracker is for bugs in Python itself.

Please ask at https://discuss.python.org/c/users/7 or https://www.pythondiscord.com/ instead.

@hugovk hugovk closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
@hugovk hugovk removed the type-bug An unexpected behavior, bug, or error label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants