So I have a 4 dimensional array, and a really simple function to aid with grabbing elements from said array.
Board=[[
[['K','D','S'] , ['T','R','T'] , ['X','B','R']],
[['P','P','P'] , ['P','P','P'] , ['P','P','P']],
[['0','0','0'] , ['0','0','0'] , ['0','0','0']]
],[
[['0','0','0'] , ['0','0','0'] , ['0','0','0']],
[['0','0','0'] , ['0','0','0'] , ['0','0','0']],
[['0','0','0'] , ['0','0','0'] , ['0','0','0']]
],[
[['0','0','0'] , ['0','0','0'] , ['0','0','0']],
[['p','p','p'] , ['p','p','p'] , ['p','p','p']],
[['j','r','x'] , ['t','r','t'] , ['s','d','d']]
]]
def GrabAPeice(title):
BigLet={'A':0,'B':1,'C':2,'D':3,'E':4}
SmallLet={'a':0,'b':1,'c':2,'d':3,'e':4}
BigNum={'5':0,'4':1,'3':2,'2':3,'1':4}
SmallNum={'5':0,'4':1,'3':2,'2':3,'1':4}
return Board[BigNum[title[2]]][SmallNum[title[4]]][BigLet[title[0]]][SmallLet[title[1]]]
Where title would be something like 'Aa1:2' respectively
The only problem is when I try to use the function for assignment,
GrabAPeice('Bb2:2')='Q'
it does not let me assign a value.
Is it possible to have a function return a reference or an alias to another object in python?
I know about get and set functions and I really won't use them.