Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- board = []
- for row_num in range(20):
- row = []
- for col_num in range(17):
- row.append("( )")
- board.append(row)
- N = 20
- for i in range(0,11):
- board[i].insert(15, str(N - i))
- board[i].insert(0, str(N - i))
- for i in range(11,20):
- board[i].insert(15, str(N - i)+ " ")
- board[i].insert(0, str(N - i) + " ")
- def print_board():
- print("-----A----B----C----D----E----F----G----H----I----J----K----L----M----N----O-----")
- for row in range(20):
- for col in range(17):
- token = board[row][col]
- if not token:
- token = " "
- print(token,end=" ")
- print()
- print("-----A----B----C----D----E----F----G----H----I----J----K----L----M----N----O-----")
- # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
- alpha_to_index = {'a':1, 'b':2, 'c':3,'d':4, 'e':5,
- 'f':6,'g':7, 'h':8, 'i':9,'j':10,
- 'k':11, 'l':12, 'm':13, 'n':14, 'o':15
- }
- numeric_to_index = {'1':19, '2':18, '3':17, '4':16, '5':15,
- '6':14, '7':13, '8':12, '9':11, '10':10,
- '11':9, '12':8, '13':7, '14':6, '15':5,
- '16':4, '17':3, '18':2, '19':1, '20':0
- }
- def char_move(token,old_let, old_num, move_dist):
- print_board()
- testing = True
- while testing:
- imp = input("Enter a Square")
- cols,leng = (imp[-1]),(len(imp)-1)
- rows = (imp[0:leng])
- col, row = alpha_to_index.get(cols), numeric_to_index.get(rows)
- print(old_let,old_num)
- print(col,row)
- num_diff = abs(old_num-row)
- let_diff = abs(old_let-col)
- print("let diff", let_diff)
- if board[row][col] != "( )" or let_diff > move_dist or num_diff > move_dist:
- print("You Cannot Move There")
- continue
- else:
- board[old_num].pop(old_let) and board[old_num].insert(old_let,"( )")
- board[row].pop(col) and board[row].insert(col,token)
- old_let,old_num = col, row
- return old_let,old_num
- def sp(row, col ,token,old_let, old_num):
- col, row = alpha_to_index.get(col), numeric_to_index.get(row)
- if board[row][col] == "( )":
- board[old_num].pop(old_let) and board[old_num].insert(old_let,"( )")
- board[row].pop(col) and board[row].insert(col,token)
- old_let,old_num = col, row
- return old_let,old_num
- def char_fight():
- print_board()
- imp = input("Enter a Square")
- cols,leng = (imp[-1]),(len(imp)-1)
- rows = (imp[0:leng])
- col,row = alpha_to_index.get(cols), numeric_to_index.get(rows)
- if board[row][col] == "( )":
- print("You Swing Your Weapon Through The Air")
- else:
- print("Your Attack Hits")
- def choose_menu():
- print("""
- _________________________
- | CHOOSE |
- |_______________________|
- | 1) Fighter 2)Wizard |
- | 3) Priest 4)Archer |
- | 5) End Turn |
- |_______________________|
- """
- )
- def fighter_menu():
- print("""
- _______________________
- | FIGHTER ATTACK |
- |______________________|
- | 1) Fight 3) EndTurn |
- | 2) Move |
- |______________________|
- """)
- def archer_menu():
- print("""
- _______________________
- | ARCHER ATTACK |
- |______________________|
- | 1) Fight 3) EndTurn |
- | 2) Move |
- |______________________|
- """)
- def wizard_menu():
- print("""
- _______________________
- | WIZARD ATTACK |
- |______________________|
- | 1) Fight 3) Move |
- | 2) Spell 4) Endturn |
- |______________________|
- """)
- def priest_menu():
- print("""
- _______________________
- | PRIEST ATTACK |
- |______________________|
- | 1) Fight 3) Move |
- | 2) Spell 4) Endturn |
- |______________________|
- """)
- archer,priest,fighter,wizard = ' @➹',' ۩†',' Φ╅',' Ψ!'
- skeleton,mutant,comrade = '\☠/','๑☢๑','☭☺☭'
- al,pl,fl,wl,sl,ml,cl= 1,2,2,3,14,14,15
- an,pn,fn,wn,sn,mn,cn= 19,19,18,19,0,0,1
- #move distance
- ad,pd,fd,wd,sd,md,cd, = 2,2,3,2,2,2,4
- #starting positions
- al,an = sp("1","a",archer,al,an)
- pl,pn = sp("1","b",priest,pl,pn)
- wl,wn = sp("1","c",wizard,wl,wn)
- fl,fn = sp("2","b",fighter,fl,fn)
- sl,sn = sp("20","o",skeleton,sl,sn)
- ml,mn = sp("20","m",mutant,ml,mn)
- cl,cn = sp("19","n",comrade,cl,cn)
- print_board()
- playing = True
- turn = 0
- while playing:
- Turn = True
- while Turn:
- turn = turn + 1
- dis_lis = []
- print("Turn", turn)
- choosing = True
- while choosing:
- choose_menu()
- A = input(">")
- if A == "1":
- if "f_e_t" in dis_lis:
- print("You Cannot Use Your Fighter")
- elif "f_e_t" not in dis_lis:
- fighter_turn = True
- while fighter_turn:
- print_board()
- fighter_menu()
- B = input(">")
- if B == "1":
- if "f_f" not in dis_lis:
- dis_lis.append("f_f")
- char_fight()
- elif "f_f" in dis_lis:
- print("You Cannot Fight")
- elif B == "2":
- if "f_m" not in dis_lis:
- dis_lis.append("f_m")
- fl,fn = char_move(fighter,fl,fn,fd)
- elif "f_m" in dis_lis:
- print("You Cannot Move")
- elif B == "3":
- dis_lis.append("f_e_t")
- break
- elif A == "2":
- if "w_e_t" in dis_lis:
- print("You Cannot Use Your Wizard")
- elif "w_e_t" not in dis_lis:
- wizard_turn = True
- while wizard_turn:
- print_board()
- wizard_menu()
- B = input(">")
- if B == "1":
- if "w_f" not in dis_lis or "w_s" not in dis_lis:
- dis_lis.append("w_f") and dis_lis.append("w_s")
- char_fight()
- elif "w_f" in dis_lis or "w_s" in dis_list:
- print("You Cannot Fight")
- elif B == "3":
- if "w_m" not in dis_lis:
- dis_lis.append("w_m")
- wl,wn = char_move(wizard,wl,wn,wd)
- elif "w_m" in dis_lis:
- print("You Cannot Move")
- elif B == "4":
- dis_lis.append("w_e_t")
- break
- elif A == "3":
- if "p_e_t" in dis_lis:
- print("You Cannot Use Your Priest")
- elif "p_e_t" not in dis_lis:
- priest_turn = True
- while priest_turn:
- print_board()
- priest_menu()
- B = input(">")
- if B == "1":
- if "p_f" not in dis_lis or "p_s" not in dis_lis:
- dis_lis.append("p_f") and dis_lis.append("p_s")
- char_fight()
- elif "p_f" in dis_lis or "p_s" in dis_list:
- print("You Cannot Fight")
- elif B == "3":
- if "p_m" not in dis_lis:
- dis_lis.append("p_m")
- pl,pn = char_move(priest,pl,pn,pd)
- elif "p_m" in dis_lis:
- print("You Cannot Move")
- elif B == "4":
- dis_lis.append("p_e_t")
- break
- elif A == "4":
- if "a_e_t" in dis_lis:
- print("You Cannot Use Your Archer")
- elif "a_e_t" not in dis_lis:
- archer_turn = True
- while archer_turn:
- print_board()
- archer_menu()
- B = input(">")
- if B == "1":
- if "a_f" not in dis_lis:
- dis_lis.append("a_f")
- char_fight()
- elif "a_f" in dis_lis:
- print("You Cannot Fight")
- elif B == "2":
- if "a_m" not in dis_lis:
- dis_lis.append("a_m")
- al,an = char_move(archer,al,an,ad)
- elif "a_m" in dis_lis:
- print("You Cannot Move")
- elif B == "3":
- dis_lis.append("a_e_t")
- break
- elif A == "5":
- choosing = False
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement