Whats bad/could be improved with my code?











up vote
-2
down vote

favorite












The code below pretty much is a game i'm making in which a player owns a kingdom and can manage that kingdom via ( soldiers,taxes,buildings etc ) and the player can also interact with other kingdoms. So far I haven't done much, I've mainly just worked on the soldier section as well as a file for generating names and making them stay forever and a map location selector.



======================================================= mainprogram.py =======================================================
import random
import sys
import map ######## THIS WILL DISPLAY AT TOP WHEN PROGRAM IS RUN, IGNORE THIS FOR NOW THIS WILL BE FIXED ("Your capital is located at sector X")
import variables
import names

class playerinfo:
def __init__(self):
############## GOLD/INCOME ##############

self.gold = variables.GOLD
self.income = variables.INCOME
self.tax = variables.TAX

############## SOLDIERS ##############

self.currentsoldiers = variables.SOLDIERS
self.longbowmen = variables.LONGBOWMEN
self.archers = variables.ARCHERS
self.cavalry = variables.CAVALRY
self.footsoldiers = variables.FOOTSOLDIERS
self.knights = variables.KNIGHTS
self.spearmen = variables.SPEARMEN
self.swordsmen = variables.SWORDSMEN
self.crossbowmen = variables.CROSSBOWMEN
self.billmen = variables.BILLMEN
self.housecarls = variables.HOUSECARLS
self.mercenaries = variables.MERCENARIES

############## PUBLIC IMAGE ##############

self.moral = variables.MORAL
self.food = variables.FOOD
self.squalor = variables.SQUALOR

############## SETTINGS ##############

self.difficulty = 0



player = playerinfo()

##print("Total Soldiers:", player.soldiers)
##print("Gold:", player.gold)

def mainmenu():
print("""
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
███ ███
███ Play ███
███ Help ███
███ Credits ███
███ Quit ███
███ ███
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
""")

choices = {
'play':difficultymenu,
'quit':sys.exit
# 'help':helpmenu, ######## NOT DONE ########
# 'credits':creditsmenu ######## NOT DONE ########
}

while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def difficultymenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ Easy ███
███ Medium ███
███ Hard ███
███ Back ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userchoice = input("》 ").lower()
if userchoice == 'easy':
difficulty = 1
elif userchoice == 'medium':
difficulty = 2
elif userchoice == 'hard':
difficulty = 3
else:
print("Please enter a valid response.")
continue
botmenu()

def botmenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ How many enemies would ███
███ you like to play ███
███ Against? (1-10) ███
███ ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userinput = int(input("》 "))
if userinput == str:
print("Please enter a valid response.")
continue
else:
random.shuffle(names.enemybot_names)
#for m in range(userinput):
# print("n" + enemybot_names[m])

playing_screen()


def playing_screen():

print("""
███████████████████████████████████████
██ ██
""",names.kingdomnameperm,"""
██ ██
███████████████████████████████████████
████ ████
███ ███
█ █

Gold: C.""" + str(player.gold),"""
Total Soldiers:""",player.currentsoldiers,"""
Public Moral:""",player.moral,"""
Income:""",player.income,"""

█ █
███ ███
████ ████
███████████████████████████████████████
██ ██

>> Scout ######## NOT DONE ########
>> Buildings ######## NOT DONE ########
>> Soldiers ######## IN PROGRESS ########
>> Taxes ######## NOT DONE ########
>> Info ######## NOT DONE ########
>> Perks ######## NOT DONE ########
>> End Turn ######## NOT DONE ########

██ ██
███████████████████████████████████████
""")

choices = {'soldiers':soldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def soldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Buy Soldiers ######## IN PROGRESS ########
>> Sell Soldiers ######## NOT DONE ########
>> Info ######## IN PROGRESS ########
>> Back

██ ██
███████████████████████████████████████
""")

choices = {'buy soldiers':buysoldiersmenu,
'info':infosoldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def infosoldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Total Soldiers:""",(player.currentsoldiers),"""
>> Longbow men:""",(player.longbowmen),"""
>> Archers:""",(player.archers),"""
>> Cavalry:""",(player.cavalry),"""
>> Foot soldiers:""",(player.footsoldiers),"""
>> Knights:""",(player.knights),"""
>> Spearmen:""",(player.spearmen),"""
>> Swordmen:""",(player.swordsmen),"""
>> Crossbow men:""",(player.crossbowmen),"""
>> Billmen:""",(player.billmen),"""
>> Housecarls:""",(player.housecarls),"""
>> Back

██ ██
███████████████████████████████████████
""")
while True:
userinput = str(input("》 "))
if userinput == "back":
soldiersmenu()
else:
print("Please enter a valid response.")
continue

def buysoldiersmenu():
print("""
███████████████████████████████████████
██ ██

Gold: C.""" + str(player.gold),"""
>> [1] Longbow men, C.25
>> [2]Archers, C.15
>> [3]Cavalry, C.40 ######## NOT DONE ########
>> [4]Footsoldiers, C.10 ######## NOT DONE ########
>> [5]Knights, C.30 ######## NOT DONE ########
>> [6]Spearmen, C.8 ######## NOT DONE ########
>> [7]Swordmen, C.20 ######## NOT DONE ########
>> [8]Crossbow men, C.15 ######## NOT DONE ########
>> [9]Billmen, C.50 ######## NOT DONE ########
>> [10]Housecarls, C.40 ######## NOT DONE ########
>> Mercenaries ######## NOT DONE ########
>> Back

██ ██
███████████████████████████████████████
""")

while True:
userinput = input("》 ")
if userinput == '1':
player.gold = player.gold - 25
player.longbowmen = player.longbowmen + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 25
player.longbowmen = player.longbowmen - 1
continue
print("Purchase successful.")

if userinput == '2':
player.gold = player.gold - 15
player.archers = player.archers + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 15
player.archers = player.archers - 1
continue
print("Purchase successful.")

if userinput == 'back':
soldiersmenu()

mainmenu()

======================================================= variables.py =======================================================

#######################################################################
############### SOLDIERS VARIABLES ###############
#######################################################################
###### NEW GAME AMOUNT OF SOLDIERS #####
LONGBOWMEN = 25
ARCHERS = 25
CAVALRY = 25
FOOTSOLDIERS = 100
KNIGHTS = 10
SPEARMEN = 15
SWORDSMEN = 25
CROSSBOWMEN = 25
BILLMEN = 10
HOUSECARLS = 10
MERCENARIES = 0
##### TOTAL SOLDIERS AMOUNT #####
SOLDIERS = LONGBOWMEN + ARCHERS + CAVALRY + FOOTSOLDIERS + KNIGHTS + SPEARMEN + SWORDSMEN + CROSSBOWMEN + BILLMEN + HOUSECARLS + MERCENARIES
#######################################################################
############### GOLD VARIABLES ###############
#######################################################################
GOLD = 500
INCOME = 100
TAX = 1.09
#######################################################################
############### PUBLIC IMAGE VARIABLES ###############
#######################################################################
MORAL = 60
FOOD = 85
SQUALOR = 2

======================================================= names.py =======================================================

import random

enemybot_names = ["Barbarians","Orcs","Demons","Elves","Mutants","Murlocs","Reapers","Dardrahydron","Saxons","Huns","Romans","Briton","Franks","Linnets","Rebels","Merchant kings","The Dark Spirits","Hugeons","Teapots"]
kingdom_names = ["Kroteron Kingdom","Slurin Empire","Chedian Kingdom","Aecrevia Dynasty","Aechougalla Empire","Gresohan Empire","Prokkuca Empire","Slouffinate Dynasty","Qememore Kingdom","Asheoddosha Dynasty","Ulubia Dynasty","Ukheowen Empire","Preavaria Dynasty","Teosha Kingdom","Estameania Empire","Phouyedora Empire","Ithushoya Kingdom","Pounyth Dynasty","Krivia Empire","Mara Kingdom","Reopia Empire","Ihezzuvalon Empire","Taecoseon Empire","Yuryn Dynasty","Yaeddivalon Empire","Wrougupia Empire","Gaibinyth Dynasty"]

kingdomlocation = ""
permkingdom = 0
permkingdomname = 0
kingdomnameperm = ""

if permkingdomname == 0:
random.shuffle(kingdom_names)
for q in range(1):
kingdomnameperm = kingdom_names[q]
permkingdomname = 1

======================================================= map.py =======================================================

import random
import names

kingdom_map_dictionary = {1 : 'A',
2 : 'B',
3 : 'C',
4 : 'D',
5 : 'E',
6 : 'F',
7 : 'G',
8 : 'H',
9 : 'A1',
10 : 'B1',
11 : 'C1',
12 : 'D1',
13 : 'E1',
14 : 'F1',
15 : 'G1',
16 : 'H1',
17 : 'A2',
18 : 'B2',
19 : 'C2',
20 : 'D2',
21 : 'E2',
22 : 'F2',
23 : 'G2',
24 : 'H2',
25 : 'A3',
26 : 'B3',
27 : 'C3',
28 : 'D3',
29 : 'E3',
30 : 'F3',
31 : 'G3',
32 : 'H3',
33 : 'A4',
34 : 'B4',
35 : 'C4',
36 : 'D4',
37 : 'E4',
38 : 'F4',
39 : 'G4',
40 : 'H4',
41 : 'A5',
42 : 'B5',
43 : 'C5',
44 : 'D5',
45 : 'E5',
46 : 'F5',
47 : 'G5',
48 : 'H5',
49 : 'A6',
50 : 'B6',
51 : 'C6',
52 : 'D6',
53 : 'E6',
54 : 'F6',
55 : 'G6',
56 : 'H6',
57 : 'A7',
58 : 'B7',
59 : 'C7',
60 : 'D7',
61 : 'E7',
62 : 'F7',
63 : 'G7',
64 : 'H7'}

if names.permkingdom == 0:
names.kingdomplacement = random.randint(1,64)
names.kingdomlocation = kingdom_map_dictionary[names.kingdomplacement]
print("Your capital is located at sector",names.kingdomlocation)
names.permkingdom = 1









share|improve this question









New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
    – LaytonUK
    Nov 14 at 18:57








  • 3




    Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    – Toby Speight
    Nov 14 at 20:58















up vote
-2
down vote

favorite












The code below pretty much is a game i'm making in which a player owns a kingdom and can manage that kingdom via ( soldiers,taxes,buildings etc ) and the player can also interact with other kingdoms. So far I haven't done much, I've mainly just worked on the soldier section as well as a file for generating names and making them stay forever and a map location selector.



======================================================= mainprogram.py =======================================================
import random
import sys
import map ######## THIS WILL DISPLAY AT TOP WHEN PROGRAM IS RUN, IGNORE THIS FOR NOW THIS WILL BE FIXED ("Your capital is located at sector X")
import variables
import names

class playerinfo:
def __init__(self):
############## GOLD/INCOME ##############

self.gold = variables.GOLD
self.income = variables.INCOME
self.tax = variables.TAX

############## SOLDIERS ##############

self.currentsoldiers = variables.SOLDIERS
self.longbowmen = variables.LONGBOWMEN
self.archers = variables.ARCHERS
self.cavalry = variables.CAVALRY
self.footsoldiers = variables.FOOTSOLDIERS
self.knights = variables.KNIGHTS
self.spearmen = variables.SPEARMEN
self.swordsmen = variables.SWORDSMEN
self.crossbowmen = variables.CROSSBOWMEN
self.billmen = variables.BILLMEN
self.housecarls = variables.HOUSECARLS
self.mercenaries = variables.MERCENARIES

############## PUBLIC IMAGE ##############

self.moral = variables.MORAL
self.food = variables.FOOD
self.squalor = variables.SQUALOR

############## SETTINGS ##############

self.difficulty = 0



player = playerinfo()

##print("Total Soldiers:", player.soldiers)
##print("Gold:", player.gold)

def mainmenu():
print("""
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
███ ███
███ Play ███
███ Help ███
███ Credits ███
███ Quit ███
███ ███
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
""")

choices = {
'play':difficultymenu,
'quit':sys.exit
# 'help':helpmenu, ######## NOT DONE ########
# 'credits':creditsmenu ######## NOT DONE ########
}

while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def difficultymenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ Easy ███
███ Medium ███
███ Hard ███
███ Back ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userchoice = input("》 ").lower()
if userchoice == 'easy':
difficulty = 1
elif userchoice == 'medium':
difficulty = 2
elif userchoice == 'hard':
difficulty = 3
else:
print("Please enter a valid response.")
continue
botmenu()

def botmenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ How many enemies would ███
███ you like to play ███
███ Against? (1-10) ███
███ ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userinput = int(input("》 "))
if userinput == str:
print("Please enter a valid response.")
continue
else:
random.shuffle(names.enemybot_names)
#for m in range(userinput):
# print("n" + enemybot_names[m])

playing_screen()


def playing_screen():

print("""
███████████████████████████████████████
██ ██
""",names.kingdomnameperm,"""
██ ██
███████████████████████████████████████
████ ████
███ ███
█ █

Gold: C.""" + str(player.gold),"""
Total Soldiers:""",player.currentsoldiers,"""
Public Moral:""",player.moral,"""
Income:""",player.income,"""

█ █
███ ███
████ ████
███████████████████████████████████████
██ ██

>> Scout ######## NOT DONE ########
>> Buildings ######## NOT DONE ########
>> Soldiers ######## IN PROGRESS ########
>> Taxes ######## NOT DONE ########
>> Info ######## NOT DONE ########
>> Perks ######## NOT DONE ########
>> End Turn ######## NOT DONE ########

██ ██
███████████████████████████████████████
""")

choices = {'soldiers':soldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def soldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Buy Soldiers ######## IN PROGRESS ########
>> Sell Soldiers ######## NOT DONE ########
>> Info ######## IN PROGRESS ########
>> Back

██ ██
███████████████████████████████████████
""")

choices = {'buy soldiers':buysoldiersmenu,
'info':infosoldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def infosoldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Total Soldiers:""",(player.currentsoldiers),"""
>> Longbow men:""",(player.longbowmen),"""
>> Archers:""",(player.archers),"""
>> Cavalry:""",(player.cavalry),"""
>> Foot soldiers:""",(player.footsoldiers),"""
>> Knights:""",(player.knights),"""
>> Spearmen:""",(player.spearmen),"""
>> Swordmen:""",(player.swordsmen),"""
>> Crossbow men:""",(player.crossbowmen),"""
>> Billmen:""",(player.billmen),"""
>> Housecarls:""",(player.housecarls),"""
>> Back

██ ██
███████████████████████████████████████
""")
while True:
userinput = str(input("》 "))
if userinput == "back":
soldiersmenu()
else:
print("Please enter a valid response.")
continue

def buysoldiersmenu():
print("""
███████████████████████████████████████
██ ██

Gold: C.""" + str(player.gold),"""
>> [1] Longbow men, C.25
>> [2]Archers, C.15
>> [3]Cavalry, C.40 ######## NOT DONE ########
>> [4]Footsoldiers, C.10 ######## NOT DONE ########
>> [5]Knights, C.30 ######## NOT DONE ########
>> [6]Spearmen, C.8 ######## NOT DONE ########
>> [7]Swordmen, C.20 ######## NOT DONE ########
>> [8]Crossbow men, C.15 ######## NOT DONE ########
>> [9]Billmen, C.50 ######## NOT DONE ########
>> [10]Housecarls, C.40 ######## NOT DONE ########
>> Mercenaries ######## NOT DONE ########
>> Back

██ ██
███████████████████████████████████████
""")

while True:
userinput = input("》 ")
if userinput == '1':
player.gold = player.gold - 25
player.longbowmen = player.longbowmen + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 25
player.longbowmen = player.longbowmen - 1
continue
print("Purchase successful.")

if userinput == '2':
player.gold = player.gold - 15
player.archers = player.archers + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 15
player.archers = player.archers - 1
continue
print("Purchase successful.")

if userinput == 'back':
soldiersmenu()

mainmenu()

======================================================= variables.py =======================================================

#######################################################################
############### SOLDIERS VARIABLES ###############
#######################################################################
###### NEW GAME AMOUNT OF SOLDIERS #####
LONGBOWMEN = 25
ARCHERS = 25
CAVALRY = 25
FOOTSOLDIERS = 100
KNIGHTS = 10
SPEARMEN = 15
SWORDSMEN = 25
CROSSBOWMEN = 25
BILLMEN = 10
HOUSECARLS = 10
MERCENARIES = 0
##### TOTAL SOLDIERS AMOUNT #####
SOLDIERS = LONGBOWMEN + ARCHERS + CAVALRY + FOOTSOLDIERS + KNIGHTS + SPEARMEN + SWORDSMEN + CROSSBOWMEN + BILLMEN + HOUSECARLS + MERCENARIES
#######################################################################
############### GOLD VARIABLES ###############
#######################################################################
GOLD = 500
INCOME = 100
TAX = 1.09
#######################################################################
############### PUBLIC IMAGE VARIABLES ###############
#######################################################################
MORAL = 60
FOOD = 85
SQUALOR = 2

======================================================= names.py =======================================================

import random

enemybot_names = ["Barbarians","Orcs","Demons","Elves","Mutants","Murlocs","Reapers","Dardrahydron","Saxons","Huns","Romans","Briton","Franks","Linnets","Rebels","Merchant kings","The Dark Spirits","Hugeons","Teapots"]
kingdom_names = ["Kroteron Kingdom","Slurin Empire","Chedian Kingdom","Aecrevia Dynasty","Aechougalla Empire","Gresohan Empire","Prokkuca Empire","Slouffinate Dynasty","Qememore Kingdom","Asheoddosha Dynasty","Ulubia Dynasty","Ukheowen Empire","Preavaria Dynasty","Teosha Kingdom","Estameania Empire","Phouyedora Empire","Ithushoya Kingdom","Pounyth Dynasty","Krivia Empire","Mara Kingdom","Reopia Empire","Ihezzuvalon Empire","Taecoseon Empire","Yuryn Dynasty","Yaeddivalon Empire","Wrougupia Empire","Gaibinyth Dynasty"]

kingdomlocation = ""
permkingdom = 0
permkingdomname = 0
kingdomnameperm = ""

if permkingdomname == 0:
random.shuffle(kingdom_names)
for q in range(1):
kingdomnameperm = kingdom_names[q]
permkingdomname = 1

======================================================= map.py =======================================================

import random
import names

kingdom_map_dictionary = {1 : 'A',
2 : 'B',
3 : 'C',
4 : 'D',
5 : 'E',
6 : 'F',
7 : 'G',
8 : 'H',
9 : 'A1',
10 : 'B1',
11 : 'C1',
12 : 'D1',
13 : 'E1',
14 : 'F1',
15 : 'G1',
16 : 'H1',
17 : 'A2',
18 : 'B2',
19 : 'C2',
20 : 'D2',
21 : 'E2',
22 : 'F2',
23 : 'G2',
24 : 'H2',
25 : 'A3',
26 : 'B3',
27 : 'C3',
28 : 'D3',
29 : 'E3',
30 : 'F3',
31 : 'G3',
32 : 'H3',
33 : 'A4',
34 : 'B4',
35 : 'C4',
36 : 'D4',
37 : 'E4',
38 : 'F4',
39 : 'G4',
40 : 'H4',
41 : 'A5',
42 : 'B5',
43 : 'C5',
44 : 'D5',
45 : 'E5',
46 : 'F5',
47 : 'G5',
48 : 'H5',
49 : 'A6',
50 : 'B6',
51 : 'C6',
52 : 'D6',
53 : 'E6',
54 : 'F6',
55 : 'G6',
56 : 'H6',
57 : 'A7',
58 : 'B7',
59 : 'C7',
60 : 'D7',
61 : 'E7',
62 : 'F7',
63 : 'G7',
64 : 'H7'}

if names.permkingdom == 0:
names.kingdomplacement = random.randint(1,64)
names.kingdomlocation = kingdom_map_dictionary[names.kingdomplacement]
print("Your capital is located at sector",names.kingdomlocation)
names.permkingdom = 1









share|improve this question









New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
    – LaytonUK
    Nov 14 at 18:57








  • 3




    Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    – Toby Speight
    Nov 14 at 20:58













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











The code below pretty much is a game i'm making in which a player owns a kingdom and can manage that kingdom via ( soldiers,taxes,buildings etc ) and the player can also interact with other kingdoms. So far I haven't done much, I've mainly just worked on the soldier section as well as a file for generating names and making them stay forever and a map location selector.



======================================================= mainprogram.py =======================================================
import random
import sys
import map ######## THIS WILL DISPLAY AT TOP WHEN PROGRAM IS RUN, IGNORE THIS FOR NOW THIS WILL BE FIXED ("Your capital is located at sector X")
import variables
import names

class playerinfo:
def __init__(self):
############## GOLD/INCOME ##############

self.gold = variables.GOLD
self.income = variables.INCOME
self.tax = variables.TAX

############## SOLDIERS ##############

self.currentsoldiers = variables.SOLDIERS
self.longbowmen = variables.LONGBOWMEN
self.archers = variables.ARCHERS
self.cavalry = variables.CAVALRY
self.footsoldiers = variables.FOOTSOLDIERS
self.knights = variables.KNIGHTS
self.spearmen = variables.SPEARMEN
self.swordsmen = variables.SWORDSMEN
self.crossbowmen = variables.CROSSBOWMEN
self.billmen = variables.BILLMEN
self.housecarls = variables.HOUSECARLS
self.mercenaries = variables.MERCENARIES

############## PUBLIC IMAGE ##############

self.moral = variables.MORAL
self.food = variables.FOOD
self.squalor = variables.SQUALOR

############## SETTINGS ##############

self.difficulty = 0



player = playerinfo()

##print("Total Soldiers:", player.soldiers)
##print("Gold:", player.gold)

def mainmenu():
print("""
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
███ ███
███ Play ███
███ Help ███
███ Credits ███
███ Quit ███
███ ███
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
""")

choices = {
'play':difficultymenu,
'quit':sys.exit
# 'help':helpmenu, ######## NOT DONE ########
# 'credits':creditsmenu ######## NOT DONE ########
}

while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def difficultymenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ Easy ███
███ Medium ███
███ Hard ███
███ Back ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userchoice = input("》 ").lower()
if userchoice == 'easy':
difficulty = 1
elif userchoice == 'medium':
difficulty = 2
elif userchoice == 'hard':
difficulty = 3
else:
print("Please enter a valid response.")
continue
botmenu()

def botmenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ How many enemies would ███
███ you like to play ███
███ Against? (1-10) ███
███ ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userinput = int(input("》 "))
if userinput == str:
print("Please enter a valid response.")
continue
else:
random.shuffle(names.enemybot_names)
#for m in range(userinput):
# print("n" + enemybot_names[m])

playing_screen()


def playing_screen():

print("""
███████████████████████████████████████
██ ██
""",names.kingdomnameperm,"""
██ ██
███████████████████████████████████████
████ ████
███ ███
█ █

Gold: C.""" + str(player.gold),"""
Total Soldiers:""",player.currentsoldiers,"""
Public Moral:""",player.moral,"""
Income:""",player.income,"""

█ █
███ ███
████ ████
███████████████████████████████████████
██ ██

>> Scout ######## NOT DONE ########
>> Buildings ######## NOT DONE ########
>> Soldiers ######## IN PROGRESS ########
>> Taxes ######## NOT DONE ########
>> Info ######## NOT DONE ########
>> Perks ######## NOT DONE ########
>> End Turn ######## NOT DONE ########

██ ██
███████████████████████████████████████
""")

choices = {'soldiers':soldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def soldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Buy Soldiers ######## IN PROGRESS ########
>> Sell Soldiers ######## NOT DONE ########
>> Info ######## IN PROGRESS ########
>> Back

██ ██
███████████████████████████████████████
""")

choices = {'buy soldiers':buysoldiersmenu,
'info':infosoldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def infosoldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Total Soldiers:""",(player.currentsoldiers),"""
>> Longbow men:""",(player.longbowmen),"""
>> Archers:""",(player.archers),"""
>> Cavalry:""",(player.cavalry),"""
>> Foot soldiers:""",(player.footsoldiers),"""
>> Knights:""",(player.knights),"""
>> Spearmen:""",(player.spearmen),"""
>> Swordmen:""",(player.swordsmen),"""
>> Crossbow men:""",(player.crossbowmen),"""
>> Billmen:""",(player.billmen),"""
>> Housecarls:""",(player.housecarls),"""
>> Back

██ ██
███████████████████████████████████████
""")
while True:
userinput = str(input("》 "))
if userinput == "back":
soldiersmenu()
else:
print("Please enter a valid response.")
continue

def buysoldiersmenu():
print("""
███████████████████████████████████████
██ ██

Gold: C.""" + str(player.gold),"""
>> [1] Longbow men, C.25
>> [2]Archers, C.15
>> [3]Cavalry, C.40 ######## NOT DONE ########
>> [4]Footsoldiers, C.10 ######## NOT DONE ########
>> [5]Knights, C.30 ######## NOT DONE ########
>> [6]Spearmen, C.8 ######## NOT DONE ########
>> [7]Swordmen, C.20 ######## NOT DONE ########
>> [8]Crossbow men, C.15 ######## NOT DONE ########
>> [9]Billmen, C.50 ######## NOT DONE ########
>> [10]Housecarls, C.40 ######## NOT DONE ########
>> Mercenaries ######## NOT DONE ########
>> Back

██ ██
███████████████████████████████████████
""")

while True:
userinput = input("》 ")
if userinput == '1':
player.gold = player.gold - 25
player.longbowmen = player.longbowmen + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 25
player.longbowmen = player.longbowmen - 1
continue
print("Purchase successful.")

if userinput == '2':
player.gold = player.gold - 15
player.archers = player.archers + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 15
player.archers = player.archers - 1
continue
print("Purchase successful.")

if userinput == 'back':
soldiersmenu()

mainmenu()

======================================================= variables.py =======================================================

#######################################################################
############### SOLDIERS VARIABLES ###############
#######################################################################
###### NEW GAME AMOUNT OF SOLDIERS #####
LONGBOWMEN = 25
ARCHERS = 25
CAVALRY = 25
FOOTSOLDIERS = 100
KNIGHTS = 10
SPEARMEN = 15
SWORDSMEN = 25
CROSSBOWMEN = 25
BILLMEN = 10
HOUSECARLS = 10
MERCENARIES = 0
##### TOTAL SOLDIERS AMOUNT #####
SOLDIERS = LONGBOWMEN + ARCHERS + CAVALRY + FOOTSOLDIERS + KNIGHTS + SPEARMEN + SWORDSMEN + CROSSBOWMEN + BILLMEN + HOUSECARLS + MERCENARIES
#######################################################################
############### GOLD VARIABLES ###############
#######################################################################
GOLD = 500
INCOME = 100
TAX = 1.09
#######################################################################
############### PUBLIC IMAGE VARIABLES ###############
#######################################################################
MORAL = 60
FOOD = 85
SQUALOR = 2

======================================================= names.py =======================================================

import random

enemybot_names = ["Barbarians","Orcs","Demons","Elves","Mutants","Murlocs","Reapers","Dardrahydron","Saxons","Huns","Romans","Briton","Franks","Linnets","Rebels","Merchant kings","The Dark Spirits","Hugeons","Teapots"]
kingdom_names = ["Kroteron Kingdom","Slurin Empire","Chedian Kingdom","Aecrevia Dynasty","Aechougalla Empire","Gresohan Empire","Prokkuca Empire","Slouffinate Dynasty","Qememore Kingdom","Asheoddosha Dynasty","Ulubia Dynasty","Ukheowen Empire","Preavaria Dynasty","Teosha Kingdom","Estameania Empire","Phouyedora Empire","Ithushoya Kingdom","Pounyth Dynasty","Krivia Empire","Mara Kingdom","Reopia Empire","Ihezzuvalon Empire","Taecoseon Empire","Yuryn Dynasty","Yaeddivalon Empire","Wrougupia Empire","Gaibinyth Dynasty"]

kingdomlocation = ""
permkingdom = 0
permkingdomname = 0
kingdomnameperm = ""

if permkingdomname == 0:
random.shuffle(kingdom_names)
for q in range(1):
kingdomnameperm = kingdom_names[q]
permkingdomname = 1

======================================================= map.py =======================================================

import random
import names

kingdom_map_dictionary = {1 : 'A',
2 : 'B',
3 : 'C',
4 : 'D',
5 : 'E',
6 : 'F',
7 : 'G',
8 : 'H',
9 : 'A1',
10 : 'B1',
11 : 'C1',
12 : 'D1',
13 : 'E1',
14 : 'F1',
15 : 'G1',
16 : 'H1',
17 : 'A2',
18 : 'B2',
19 : 'C2',
20 : 'D2',
21 : 'E2',
22 : 'F2',
23 : 'G2',
24 : 'H2',
25 : 'A3',
26 : 'B3',
27 : 'C3',
28 : 'D3',
29 : 'E3',
30 : 'F3',
31 : 'G3',
32 : 'H3',
33 : 'A4',
34 : 'B4',
35 : 'C4',
36 : 'D4',
37 : 'E4',
38 : 'F4',
39 : 'G4',
40 : 'H4',
41 : 'A5',
42 : 'B5',
43 : 'C5',
44 : 'D5',
45 : 'E5',
46 : 'F5',
47 : 'G5',
48 : 'H5',
49 : 'A6',
50 : 'B6',
51 : 'C6',
52 : 'D6',
53 : 'E6',
54 : 'F6',
55 : 'G6',
56 : 'H6',
57 : 'A7',
58 : 'B7',
59 : 'C7',
60 : 'D7',
61 : 'E7',
62 : 'F7',
63 : 'G7',
64 : 'H7'}

if names.permkingdom == 0:
names.kingdomplacement = random.randint(1,64)
names.kingdomlocation = kingdom_map_dictionary[names.kingdomplacement]
print("Your capital is located at sector",names.kingdomlocation)
names.permkingdom = 1









share|improve this question









New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











The code below pretty much is a game i'm making in which a player owns a kingdom and can manage that kingdom via ( soldiers,taxes,buildings etc ) and the player can also interact with other kingdoms. So far I haven't done much, I've mainly just worked on the soldier section as well as a file for generating names and making them stay forever and a map location selector.



======================================================= mainprogram.py =======================================================
import random
import sys
import map ######## THIS WILL DISPLAY AT TOP WHEN PROGRAM IS RUN, IGNORE THIS FOR NOW THIS WILL BE FIXED ("Your capital is located at sector X")
import variables
import names

class playerinfo:
def __init__(self):
############## GOLD/INCOME ##############

self.gold = variables.GOLD
self.income = variables.INCOME
self.tax = variables.TAX

############## SOLDIERS ##############

self.currentsoldiers = variables.SOLDIERS
self.longbowmen = variables.LONGBOWMEN
self.archers = variables.ARCHERS
self.cavalry = variables.CAVALRY
self.footsoldiers = variables.FOOTSOLDIERS
self.knights = variables.KNIGHTS
self.spearmen = variables.SPEARMEN
self.swordsmen = variables.SWORDSMEN
self.crossbowmen = variables.CROSSBOWMEN
self.billmen = variables.BILLMEN
self.housecarls = variables.HOUSECARLS
self.mercenaries = variables.MERCENARIES

############## PUBLIC IMAGE ##############

self.moral = variables.MORAL
self.food = variables.FOOD
self.squalor = variables.SQUALOR

############## SETTINGS ##############

self.difficulty = 0



player = playerinfo()

##print("Total Soldiers:", player.soldiers)
##print("Gold:", player.gold)

def mainmenu():
print("""
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
███ ███
███ Play ███
███ Help ███
███ Credits ███
███ Quit ███
███ ███
███████████████████████████████
██████ ██████
██████ KINGDOMS ██████
██████ ██████
███████████████████████████████
""")

choices = {
'play':difficultymenu,
'quit':sys.exit
# 'help':helpmenu, ######## NOT DONE ########
# 'credits':creditsmenu ######## NOT DONE ########
}

while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def difficultymenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ Easy ███
███ Medium ███
███ Hard ███
███ Back ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userchoice = input("》 ").lower()
if userchoice == 'easy':
difficulty = 1
elif userchoice == 'medium':
difficulty = 2
elif userchoice == 'hard':
difficulty = 3
else:
print("Please enter a valid response.")
continue
botmenu()

def botmenu():

print("""
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
███ ███
███ How many enemies would ███
███ you like to play ███
███ Against? (1-10) ███
███ ███
███ ███
███████████████████████████████
██████ ██████
██████ PLAY ██████
██████ ██████
███████████████████████████████
""")

while True:
userinput = int(input("》 "))
if userinput == str:
print("Please enter a valid response.")
continue
else:
random.shuffle(names.enemybot_names)
#for m in range(userinput):
# print("n" + enemybot_names[m])

playing_screen()


def playing_screen():

print("""
███████████████████████████████████████
██ ██
""",names.kingdomnameperm,"""
██ ██
███████████████████████████████████████
████ ████
███ ███
█ █

Gold: C.""" + str(player.gold),"""
Total Soldiers:""",player.currentsoldiers,"""
Public Moral:""",player.moral,"""
Income:""",player.income,"""

█ █
███ ███
████ ████
███████████████████████████████████████
██ ██

>> Scout ######## NOT DONE ########
>> Buildings ######## NOT DONE ########
>> Soldiers ######## IN PROGRESS ########
>> Taxes ######## NOT DONE ########
>> Info ######## NOT DONE ########
>> Perks ######## NOT DONE ########
>> End Turn ######## NOT DONE ########

██ ██
███████████████████████████████████████
""")

choices = {'soldiers':soldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def soldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Buy Soldiers ######## IN PROGRESS ########
>> Sell Soldiers ######## NOT DONE ########
>> Info ######## IN PROGRESS ########
>> Back

██ ██
███████████████████████████████████████
""")

choices = {'buy soldiers':buysoldiersmenu,
'info':infosoldiersmenu}
while True:
userchoice = input("》").lower()
if userchoice not in choices:
print("Please enter a valid response.")
continue
action = choices[userchoice]
action()

def infosoldiersmenu():
print("""
███████████████████████████████████████
██ ██

>> Total Soldiers:""",(player.currentsoldiers),"""
>> Longbow men:""",(player.longbowmen),"""
>> Archers:""",(player.archers),"""
>> Cavalry:""",(player.cavalry),"""
>> Foot soldiers:""",(player.footsoldiers),"""
>> Knights:""",(player.knights),"""
>> Spearmen:""",(player.spearmen),"""
>> Swordmen:""",(player.swordsmen),"""
>> Crossbow men:""",(player.crossbowmen),"""
>> Billmen:""",(player.billmen),"""
>> Housecarls:""",(player.housecarls),"""
>> Back

██ ██
███████████████████████████████████████
""")
while True:
userinput = str(input("》 "))
if userinput == "back":
soldiersmenu()
else:
print("Please enter a valid response.")
continue

def buysoldiersmenu():
print("""
███████████████████████████████████████
██ ██

Gold: C.""" + str(player.gold),"""
>> [1] Longbow men, C.25
>> [2]Archers, C.15
>> [3]Cavalry, C.40 ######## NOT DONE ########
>> [4]Footsoldiers, C.10 ######## NOT DONE ########
>> [5]Knights, C.30 ######## NOT DONE ########
>> [6]Spearmen, C.8 ######## NOT DONE ########
>> [7]Swordmen, C.20 ######## NOT DONE ########
>> [8]Crossbow men, C.15 ######## NOT DONE ########
>> [9]Billmen, C.50 ######## NOT DONE ########
>> [10]Housecarls, C.40 ######## NOT DONE ########
>> Mercenaries ######## NOT DONE ########
>> Back

██ ██
███████████████████████████████████████
""")

while True:
userinput = input("》 ")
if userinput == '1':
player.gold = player.gold - 25
player.longbowmen = player.longbowmen + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 25
player.longbowmen = player.longbowmen - 1
continue
print("Purchase successful.")

if userinput == '2':
player.gold = player.gold - 15
player.archers = player.archers + 1
if player.gold < 0:
print("Insufficient Funds.")
player.gold = player.gold + 15
player.archers = player.archers - 1
continue
print("Purchase successful.")

if userinput == 'back':
soldiersmenu()

mainmenu()

======================================================= variables.py =======================================================

#######################################################################
############### SOLDIERS VARIABLES ###############
#######################################################################
###### NEW GAME AMOUNT OF SOLDIERS #####
LONGBOWMEN = 25
ARCHERS = 25
CAVALRY = 25
FOOTSOLDIERS = 100
KNIGHTS = 10
SPEARMEN = 15
SWORDSMEN = 25
CROSSBOWMEN = 25
BILLMEN = 10
HOUSECARLS = 10
MERCENARIES = 0
##### TOTAL SOLDIERS AMOUNT #####
SOLDIERS = LONGBOWMEN + ARCHERS + CAVALRY + FOOTSOLDIERS + KNIGHTS + SPEARMEN + SWORDSMEN + CROSSBOWMEN + BILLMEN + HOUSECARLS + MERCENARIES
#######################################################################
############### GOLD VARIABLES ###############
#######################################################################
GOLD = 500
INCOME = 100
TAX = 1.09
#######################################################################
############### PUBLIC IMAGE VARIABLES ###############
#######################################################################
MORAL = 60
FOOD = 85
SQUALOR = 2

======================================================= names.py =======================================================

import random

enemybot_names = ["Barbarians","Orcs","Demons","Elves","Mutants","Murlocs","Reapers","Dardrahydron","Saxons","Huns","Romans","Briton","Franks","Linnets","Rebels","Merchant kings","The Dark Spirits","Hugeons","Teapots"]
kingdom_names = ["Kroteron Kingdom","Slurin Empire","Chedian Kingdom","Aecrevia Dynasty","Aechougalla Empire","Gresohan Empire","Prokkuca Empire","Slouffinate Dynasty","Qememore Kingdom","Asheoddosha Dynasty","Ulubia Dynasty","Ukheowen Empire","Preavaria Dynasty","Teosha Kingdom","Estameania Empire","Phouyedora Empire","Ithushoya Kingdom","Pounyth Dynasty","Krivia Empire","Mara Kingdom","Reopia Empire","Ihezzuvalon Empire","Taecoseon Empire","Yuryn Dynasty","Yaeddivalon Empire","Wrougupia Empire","Gaibinyth Dynasty"]

kingdomlocation = ""
permkingdom = 0
permkingdomname = 0
kingdomnameperm = ""

if permkingdomname == 0:
random.shuffle(kingdom_names)
for q in range(1):
kingdomnameperm = kingdom_names[q]
permkingdomname = 1

======================================================= map.py =======================================================

import random
import names

kingdom_map_dictionary = {1 : 'A',
2 : 'B',
3 : 'C',
4 : 'D',
5 : 'E',
6 : 'F',
7 : 'G',
8 : 'H',
9 : 'A1',
10 : 'B1',
11 : 'C1',
12 : 'D1',
13 : 'E1',
14 : 'F1',
15 : 'G1',
16 : 'H1',
17 : 'A2',
18 : 'B2',
19 : 'C2',
20 : 'D2',
21 : 'E2',
22 : 'F2',
23 : 'G2',
24 : 'H2',
25 : 'A3',
26 : 'B3',
27 : 'C3',
28 : 'D3',
29 : 'E3',
30 : 'F3',
31 : 'G3',
32 : 'H3',
33 : 'A4',
34 : 'B4',
35 : 'C4',
36 : 'D4',
37 : 'E4',
38 : 'F4',
39 : 'G4',
40 : 'H4',
41 : 'A5',
42 : 'B5',
43 : 'C5',
44 : 'D5',
45 : 'E5',
46 : 'F5',
47 : 'G5',
48 : 'H5',
49 : 'A6',
50 : 'B6',
51 : 'C6',
52 : 'D6',
53 : 'E6',
54 : 'F6',
55 : 'G6',
56 : 'H6',
57 : 'A7',
58 : 'B7',
59 : 'C7',
60 : 'D7',
61 : 'E7',
62 : 'F7',
63 : 'G7',
64 : 'H7'}

if names.permkingdom == 0:
names.kingdomplacement = random.randint(1,64)
names.kingdomlocation = kingdom_map_dictionary[names.kingdomplacement]
print("Your capital is located at sector",names.kingdomlocation)
names.permkingdom = 1






python python-3.x






share|improve this question









New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 14 at 19:29





















New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 14 at 18:51









LaytonUK

62




62




New contributor




LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






LaytonUK is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
    – LaytonUK
    Nov 14 at 18:57








  • 3




    Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    – Toby Speight
    Nov 14 at 20:58


















  • I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
    – LaytonUK
    Nov 14 at 18:57








  • 3




    Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    – Toby Speight
    Nov 14 at 20:58
















I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
– LaytonUK
Nov 14 at 18:57






I got told by several people ( 6 ) to go to this site if i wanted it checking out, but thanks for the info.
– LaytonUK
Nov 14 at 18:57






3




3




Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
– Toby Speight
Nov 14 at 20:58




Welcome to Code Review! The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
– Toby Speight
Nov 14 at 20:58















active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






LaytonUK is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f207672%2fwhats-bad-could-be-improved-with-my-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








LaytonUK is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















LaytonUK is a new contributor. Be nice, and check out our Code of Conduct.













LaytonUK is a new contributor. Be nice, and check out our Code of Conduct.












LaytonUK is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f207672%2fwhats-bad-could-be-improved-with-my-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei