Python Game Gone Horribly Wrong!

Need a bit of help getting something to work

Page 1 of 1

7 Replies - 1401 Views - Last Post: 03 June 2009 - 09:04 AM Rate Topic: -----

#1 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Python Game Gone Horribly Wrong!

Post icon  Posted 01 June 2009 - 09:02 PM

First of all let me introduce myself seeing that this is my first post here. Hello! My name is Zack!

Alright enough chit chat, let's get to work:
So I'm trying to make a simple text game in Python. If you guys feel like this code looks familiar, that's most likely because you've seen something similar to it before. I've only been using Python for about 4 days now and have been programming overall for less than a year, and I'm trying to modify this game I found in a tutorial into my own version. I'm very close (I think), but I can't quite get it to do something I want.

Background on the Game:
Well since it's a long code I figure I should firstly let you know what is going on. Basically, there's a game board and there's random "caves" throughout the game board. I drop "nodes" that tell the player how close a cave is. Now, in the tutorial there was only one type of "cave(actually in the tutorial he was using treasure)". But I want there to be different "caves" with different things in them. The problem that is occurring is, when I play the game it runs fine, but only one type of "cave" seems to be in the gameboard. I can't get it to include all the "caves"

- I know a lot of that probably sounds like jibberish, but I'm sure you'll be able to understand what I'm talking about when you read the code. So without further ado, here's my elite level coding skills :blink: :

import random
import sys
import time

def drawBoard(board):
	hline = '	'
	for i in range(1,6):
		hline += (' ' * 9) + str(i)

	print hline
	print '   ' + ('0123456789' * 6)
	print

	for i in range(15):
		if i < 10:
			extraSpace = ' '
		else:
			extraSpace = ''
		print '%s%s %s %s' %(extraSpace, i, getRow(board, i), i )

	print
	print '   ' + ('0123456789' * 6)
	print hline


def getRow(board, row):
	boardRow = ''
	for i in range(60):
		boardRow += board[i][row]
	return boardRow

def getNewBoard():
	board = []
	for x in range(60):
		board.append([])
		for y in range(15):
			if random.randint(0,1) == 0:
				board[x].append('`')
			else:
				board[x].append('^')

	return board


def getRandomDragons(numDragons):
	dragons = []
	for i in range(numDragons):
		dragons.append([random.randint(0,59), random.randint(0,14)])
	return dragons


# could be wrong =======================
def getRandomTenCaves(numTenCaves):
	tenCaves = []
	for i in range(numTenCaves):
		tenCaves.append([random.randint(0,59), random.randint(0,14)])
	return tenCaves

# could be wrong =======================
def getRandomThreeCaves(numThreeCaves):
	threeCaves = []
	for i in range(numThreeCaves):
		threeCaves.append([random.randint(0,59), random.randint(0,14)])
	return threeCaves

# could be wrong =======================
def getRandomHolyGrail(numHolyGrails):
	holyGrail = []
	for i in range(numHolyGrails):
		holyGrail.append([random.randint(0,59), random.randint(0,14)])
	return holyGrail

						

def isValidMove(x,y):
	return x >= 0 and x <= 59 and y >= 0 and y <= 14

def makeMove(board, dragons, tenCaves, threeCaves, holyGrail, x, y):
	if not isValidMove(x,y):
		return False

	smallestDistance = 100
	for dx, dy in dragons:
		if abs(dx-x) > abs(dy-y):
			distance = abs(dx-x)
		else:
			distance = abs(dy-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You have found a Dragon, prepare for Battle!'
			time.sleep(5)
			liveOrDie = random.choice('1 2 3 4'.split())
			if liveOrDie != '2':
				dragons.remove([x,y])
				return 'You beat the dragon and took his hide!'
				
			else:
				return 'The Dragon is stronger than you thought!'
				return 'You died and lost a node! But the Dragon remains in the same spot.'
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
	for tx, ty in tenCaves:
		if abs(tx-x) > abs(ty-y):
			distance = abs(tx-x)
		else:
			distance = abs(ty-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You step into the cave.....'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				tenCaves.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find 10 Magical Nodes!'
			else:
				return 'This code will never be seen by anyone!'
			
				
			
			 
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'

	for thx, thy in threeCaves:
		if abs(thx-x) > abs(thy-y):
			distance = abs(thx-x)
		else:
			distance = abs(thy-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You step into the cave....'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				threeCaves.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find 3 Magical Nodes!' 
			else:
				return 'This code will never be seen by anyone!'
			 
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
	for hx, hy in holyGrail:
		if abs(hx-x) > abs(hy-y):
			distance = abs(hx-x)
		else:
			distance = abs(hy - y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallesDistance == 0:
			print 'You step into the cave......'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				holyGrail.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find the Holy Grail!'
			else:
				return 'This code will never be seen by anyone!'

		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
			

	
	   
		 
		 
			

def enterPlayerMove():
	print 'Where do you want to drop the next Magical Node? (0-59 0-14) (or type quit)'
	while True:
		move = raw_input()
		if move.lower() == 'quit':
			print 'Thanks for playing!'
			sys.exit()

		move = move.split()
		if len(move) == 2 and move[0].isdigit() and move[1].isdigit() and isValidMove(int(move[0]), int(move[1])):
			return [int(move[0]), int(move[1])]
		print 'Enter a number from 0 to 59, a space, then a number from 0 to 14.'


def playAgain():
	print 'Do you want to play again? (yes or no)'
	return raw_input().lower().startswith('y')


def showInstructions():
	 print '''Instructions:
 You are a brave Knight from Camelot who was sent on a dangerous quest to rid
 the world of three Dragons. You know the dragons are in the land of Camelot,
 but not exactly sure where. Luckily for you, Merlin has given you 16 Magical
 Nodes that are capable of telling you if a Dragon is near by.
 
 To play, enter the coordinates of the point in Camelot you wish to drop a
 Magical Node. The Node can find out how far away the closest Dragon is to it.
 For example, the n below marks where the node was dropped, and the 2's
 represent distances of 2 away from the node. The 4's represent
 distances of 4 away from the node.

	 444444444
	 4	   4
	 4 22222 4
	 4 2   2 4
	 4 2 n 2 4
	 4 2   2 4
	 4 22222 4
	 4	   4
	 444444444
 Press enter to continue...'''
	 raw_input()

	 print '''For example, here is a dragon (the d) located a distance of 2 away
 from the magical node (the n):

	 22222
	 d   2
	 2 n 2
	 2   2
	 22222

 The point where the node was dropped will be marked with a 2.

 The Dragons stay in their caves, so you don't have to worry abou them moving
 around. Magical Nodes can detect Dragons up to a distance of 9 miles. If all
 Dragons are out of range, the point will be marked with |

 If a node is directly dropped on a cave that has a Dragon in it, you have
 discovered the location of the Dragon, and you will have to fight it. Once
 you defeat the Dragon, you will collect his hide for proof and the Magical
 Node will remain there.

 Press enter to continue...'''
	 raw_input()
	 print
			

print 'D R A G O N ~ H U N T !'
print
print 'Would you like to view the instructions? (yes/no)'
if raw_input().lower().startswith('y'):
	showInstructions()
						

		
while True:
	magicalNodes = 16
	theBoard = getNewBoard()
	theDragons = getRandomDragons(3)
	drawBoard(theBoard)
	previousMoves = []
	#could be wrong===============
	tenNodes = getRandomTenCaves(20)
	threeNodes = getRandomThreeCaves(20)
	grail = getRandomHolyGrail(10)

	while magicalNodes > 0:
		if magicalNodes > 1: extraSnode = 's'
		else: extraSnode = ''
		if len(theDragons) > 1: extraSdrag = 's'
		else: extraSdrag = ''
		print 'You have %s Magical Node%s left. %s Dragon%s remaining.' %(magicalNodes, extraSnode, len(theDragons), extraSdrag)

		x, y = enterPlayerMove()
		previousMoves.append([x,y])

		moveResult = makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y)
		if moveResult == False:
			continue
		elif moveResult == 'You have found a Dragon, prepare for Battle!':
			for x, y in previousMoves:
					makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y)
			drawBoard(theBoard)
			print moveResult
			if moveResult == 'The Dragon is stronger than you thought!':
				magicalNodes -= 1
				time.sleep(5)
				print 'You died and lost a node!'
				time.sleep(3)
				print 'Merlin revived you.'
				time.sleep(3)
				print 'The Dragon remains in the same spot.'


		elif moveResult == 'You step into the cave.....':
			for x, y in previousMoves:
					makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y)
			drawBoard(theBoard)
			print moveResult
			if moveResult == 'This Cave doesn\'t have a Dragon in it. Instead you find 10 Magical Nodes!':
				magicalNodes += 10
				time.sleep(5)
				print 'You now have 10 more nodes to help you in your search!'


		elif moveResult == 'You step into the cave....':
			for x, y in previousMoves:
					makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y)
			drawBoard(theBoard)
			print moveResult
			if moveResult == 'This Cave doesn\'t have a Dragon in it. Instead you find 3 Magical Nodes!':
				magicalNodes += 3
				time.sleep(5)
				print 'You now have 3 more nodes to help you in your search!'


		else:
			if moveResult == 'You step into the cave......':
				for x, y in previousMoves:
					makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y)
			drawBoard(theBoard)
			print moveResult
			if moveResult == 'This Cave doesn\'t have a Dragon in it. Instead you find the Holy Grail!':
				print 'You pick up the glass......'
				time.sleep(5)
				print 'You feel weightless for a second, and then all you see is a flash of white!'
				time.sleep(5)
				print 'The Holy Grail teleported you to the Cave of the King Dragon!'
			
				
				
			
				
			
			
				
				   
		


		if len(theDragons) == 0:
			print 'You found and killed all the Dragons! Congratulations and good game!'
			break

		magicalNodes -= 1

	if magicalNodes == 0:
		print 'We\'ve run out of Magical Nodes! You now must report your'
		print 'misfortune to King Arthur!'
		print 'He will not be happy. It\'ll probably be off with your head!'
		print 'GAME OVER.'
		print '	The remaining Dragons were here:'
		for x, y in theDragons:
			print '	%s, %s' %(x,y)

	if not playAgain():
		sys.exit()






I'm pretty sure the problem is somewhere in here:

def makeMove(board, dragons, tenCaves, threeCaves, holyGrail, x, y):
	if not isValidMove(x,y):
		return False

	smallestDistance = 100
	for dx, dy in dragons:
		if abs(dx-x) > abs(dy-y):
			distance = abs(dx-x)
		else:
			distance = abs(dy-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You have found a Dragon, prepare for Battle!'
			time.sleep(5)
			liveOrDie = random.choice('1 2 3 4'.split())
			if liveOrDie != '2':
				dragons.remove([x,y])
				return 'You beat the dragon and took his hide!'
				
			else:
				return 'The Dragon is stronger than you thought!'
				return 'You died and lost a node! But the Dragon remains in the same spot.'
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
	for tx, ty in tenCaves:
		if abs(tx-x) > abs(ty-y):
			distance = abs(tx-x)
		else:
			distance = abs(ty-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You step into the cave.....'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				tenCaves.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find 10 Magical Nodes!'
			else:
				return 'This code will never be seen by anyone!'
			
				
			
			 
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'

	for thx, thy in threeCaves:
		if abs(thx-x) > abs(thy-y):
			distance = abs(thx-x)
		else:
			distance = abs(thy-y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallestDistance == 0:
			print 'You step into the cave....'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				threeCaves.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find 3 Magical Nodes!' 
			else:
				return 'This code will never be seen by anyone!'
			 
		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
	for hx, hy in holyGrail:
		if abs(hx-x) > abs(hy-y):
			distance = abs(hx-x)
		else:
			distance = abs(hy - y)

		if distance < smallestDistance:
			smallestDistance = distance

		if smallesDistance == 0:
			print 'You step into the cave......'
			time.sleep(2)
			friendOrFoe = random.choice('1'.split())
			if friendOrFoe == '1':
				holyGrail.remove([x,y])
				return 'This Cave doesn\'t have a Dragon in it. Instead you find the Holy Grail!'
			else:
				return 'This code will never be seen by anyone!'

		else:
			if smallestDistance < 10:
				board[x][y] = str(smallestDistance)
				return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
			else:
				board[x][y] = '|'
				return 'Magical Node did not detect anything. All Dragons out of range.'
			

 



Or in the part underneath the "instructions".


If you guys could find the problem it would be much appreciated! Like I said, I'm a new programmer and even newer to Python, and this is my very first game.

#Thanks!
^haha... programming joke.. get it?! B)

This post has been edited by eZACKe: 01 June 2009 - 09:04 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Python Game Gone Horribly Wrong!

#2 code_m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 24
  • View blog
  • Posts: 197
  • Joined: 21-April 09

Re: Python Game Gone Horribly Wrong!

Posted 02 June 2009 - 12:49 PM

here's the problem (took me a few tries):

holyGrail.append([random.randint(0,59), random.randint(0,14)])


You are appending the type list which contain two int types, but the rest of your code is using str types!

This post has been edited by code_m: 02 June 2009 - 01:10 PM

Was This Post Helpful? 0
  • +
  • -

#3 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Python Game Gone Horribly Wrong!

Posted 02 June 2009 - 01:55 PM

So how would I go about fixing that?

I use the same code for my "dragons", and those show up on my map just fine:

dragons.append([random.randint(0,59), random.randint(0,14)])
	return dragons


This post has been edited by eZACKe: 02 June 2009 - 02:12 PM

Was This Post Helpful? 0
  • +
  • -

#4 code_m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 24
  • View blog
  • Posts: 197
  • Joined: 21-April 09

Re: Python Game Gone Horribly Wrong!

Posted 02 June 2009 - 03:35 PM

well humph. I'm stumped then.

but I do see a syntax change you could make:
def isValidMove(x,y):
    return x >= 0 and x <= 59 and y >= 0 and y <= 14



could be written in combonation:
def isValidMove(x, y):
    return (0 <= x <= 59) and (0 <= y <= 14)



I do not believe the parathesis are nessary, but it's clear to a reader.

I will keep looking, but I'm totally stumped at the moment.
Was This Post Helpful? 0
  • +
  • -

#5 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Python Game Gone Horribly Wrong!

Posted 02 June 2009 - 03:42 PM

Alright thanks for your continued searching through my code! I looked at it for about 2 hours last night without finding the problem haha.

Also, thanks for the recomendation of the change to my "isValidMove".
Was This Post Helpful? 0
  • +
  • -

#6 code_m  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 24
  • View blog
  • Posts: 197
  • Joined: 21-April 09

Re: Python Game Gone Horribly Wrong!

Posted 03 June 2009 - 05:13 AM

Found the problem! You have too many return statements:

def makeMove(board, dragons, tenCaves, threeCaves, holyGrail, x, y):
    if not isValidMove(x,y):
        return False
#### PROBLEM: Multiple return statements across the function make code assumed to have been run never to be processed:
#### Need to find out which is the smallestDistance of [dragons, tenCaves, threeCaves, holyGrail] and return that value
#### Write a local function here for repeating else statements:
    smallestDistance = 100
    for dx, dy in dragons:
        if abs(dx-x) > abs(dy-y):
            distance = abs(dx-x)
        else:
            distance = abs(dy-y)

        if distance < smallestDistance:
            smallestDistance = distance

        if smallestDistance == 0:
            print 'You have found a Dragon, prepare for Battle!'
            time.sleep(5)
            liveOrDie = random.choice('1 2 3 4'.split())  #### Use random.randint(1, 4)
            if liveOrDie != '2':  #### use normal int type, str unneeded
                dragons.remove([x,y])
                return 'You beat the dragon and took his hide!'

            else:
            #### WRONG: TWO RETURNS:
                return 'The Dragon is stronger than you thought!'
                return 'You died and lost a node! But the Dragon remains in the same spot.'
        else:
            #### Use local function:
            if smallestDistance < 10:
                board[x][y] = str(smallestDistance)
                return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
            else:
                board[x][y] = '|'
                return 'Magical Node did not detect anything. All Dragons out of range.'

#### Will not run, has already returned:
    for tx, ty in tenCaves:
        if abs(tx-x) > abs(ty-y):
            distance = abs(tx-x)
        else:
            distance = abs(ty-y)

        if distance < smallestDistance:
            smallestDistance = distance

        if smallestDistance == 0:
            print 'You step into the cave.....'
            time.sleep(2)
            friendOrFoe = random.choice('1'.split())  #### Why is this done??
            if friendOrFoe == '1':
                tenCaves.remove([x,y])
                return 'This Cave doesn\'t have a Dragon in it. Instead you find 10 Magical Nodes!'
            else:
                return 'This code will never be seen by anyone!'




        else:
            #### Use local function:
            if smallestDistance < 10:
                board[x][y] = str(smallestDistance)
                return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
            else:
                board[x][y] = '|'
                return 'Magical Node did not detect anything. All Dragons out of range.'

    for thx, thy in threeCaves:
        if abs(thx-x) > abs(thy-y):
            distance = abs(thx-x)
        else:
            distance = abs(thy-y)

        if distance < smallestDistance:
            smallestDistance = distance

        if smallestDistance == 0:
            print 'You step into the cave....'
            time.sleep(2)
            friendOrFoe = random.choice('1'.split())  #### Why is this done???
            if friendOrFoe == '1':
                threeCaves.remove([x,y])
                return 'This Cave doesn\'t have a Dragon in it. Instead you find 3 Magical Nodes!'
            else:
                return 'This code will never be seen by anyone!'

        else:
            #### Use local function:
            if smallestDistance < 10:
                board[x][y] = str(smallestDistance)
                return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
            else:
                board[x][y] = '|'
                return 'Magical Node did not detect anything. All Dragons out of range.'
    for hx, hy in holyGrail:
        if abs(hx-x) > abs(hy-y):
            distance = abs(hx-x)
        else:
            distance = abs(hy - y)

        if distance < smallestDistance:
            smallestDistance = distance

        if smallesDistance == 0:
            print 'You step into the cave......'
            time.sleep(2)
            friendOrFoe = random.choice('1'.split()) #### Why is this done???
            if friendOrFoe == '1':
                holyGrail.remove([x,y])
                return 'This Cave doesn\'t have a Dragon in it. Instead you find the Holy Grail!'
            else:
                return 'This code will never be seen by anyone!'

        else:
            #### Use local function:
            if smallestDistance < 10:
                board[x][y] = str(smallestDistance)
                return 'Dragon\'s cave detected at a distance of %s miles from the Magical Node.' %(smallestDistance)
            else:
                board[x][y] = '|'
                return 'Magical Node did not detect anything. All Dragons out of range.'


This needs to be rewritten because return will exit any function(s) it is used in. As a matter of fact, if you write a function without a return then it will be assumed you mean return None

Some other suggestions:
--As commented above use a local function since all the else suites are the same.
---Do this by:
def foo(args):
     def boo(args):
          <suite>
     <suite>


--change EnterPlayerMove() as follows, to be more pythonic.
def enterPlayerMove():
    print 'Where do you want to drop the next Magical Node? (0-59 0-14) (or type quit)'
    while True:
        move = raw_input()
        if move.lower() == 'quit':
            print 'Thanks for playing!'
            sys.exit()

#        move = move.split()
#        if len(move) == 2 and move[0].isdigit() and move[1].isdigit() and isValidMove(int(move[0]), int(move[1])):
#            return [int(move[0]), int(move[1])]
        #### Takes more lines, but much more clear:
        try:
            move = [int(x) for x in move.split()] #### List comprehension, advanced
            if isValidMove(*move): #### * unpacks move, instead of using explicit index positions
                return move
        except ValueError: #### Replaces digit tests, raised if x is not int
            print 'Enter a number from 0 to 59, a space, then a number from 0 to 14.'
            continue
        except TypeError: #### Replaces length test, raised if *move is less or more than 2 positional arguments
            print 'Enter a number from 0 to 59, a space, then a number from 0 to 14.'
            continue


--I'm not sure why you did this within showIntructions(), typically you only have a function call to set a variable to a new value (or custom print):
        elif moveResult == 'You have found a Dragon, prepare for Battle!':
            for x, y in previousMoves:
                    makeMove(theBoard, theDragons, tenNodes, threeNodes, grail, x, y) #### Reason for call?


--Lastly throughout your code you convert everything with the "board" lists to str, and this is unneeded, a list can hold any mix of data types.

Hope that helps!
Was This Post Helpful? 1
  • +
  • -

#7 kaustubhbagwe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-June 09

Re: Python Game Gone Horribly Wrong!

Posted 03 June 2009 - 08:12 AM

hey i m kaustubh i m s.y Bsc Computer Science student.so send me c\c++.codes........ that can help me in my studies .........as well as i can be a perfect programer.............

hey i m kaustubh i m s.y Bsc Computer Science student.so send me c\c++.codes........ that can help me in my studies .........as well as i can be a perfect programer.............
Was This Post Helpful? 0
  • +
  • -

#8 eZACKe  Icon User is offline

  • Garbage Collector

Reputation: 120
  • View blog
  • Posts: 1,278
  • Joined: 01-June 09

Re: Python Game Gone Horribly Wrong!

Posted 03 June 2009 - 09:04 AM

Thanks code, that helps a lot!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1