First of all, forgive my naivete - I'm new to programming and trying to teach myself Python with the aid of the Internet and a book or two.
My current problem that I can't find a solution to is hard for me to explain. First, I'll give the code I want random.choice to look at:
sentbot = {
'fname':'Sentry Bot',
'sname':'sentry bot',
...
'state':'calm',
'attacks': {
'attack1' : {
'attmsg':'The sentry bot fires a pinpoint laser at you.',
'mindmg':2,
'maxdmg':5,
'atype':'laser' },
'attack2': {
'attmsg':'The sentry bot kicks you in the crotch.',
'mindmg':1,
'maxdmg':3,
'atype':'physical' }
},
...
}
That's an entry from my critters.py file. From the main game.py file, I want the computer to randomly choose 'attack1' or 'attack2' and be able to use the info form within those sets to determine which attack the sentry bot uses against the player. I can't for the life of me figure out how to do this. Any advice would be greatly appreciated.