Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-27 Thread conny . ledin
This is so great!!! I know i have alot of work left to do and i
probobly wont make it in time which means that i can only get the grade
E on the assignment... But at this stage it feels like ill be happy
with any grade i get, just to have this behind me. Programming is
apparently not my thing. It feels like the movement was the hardest
part of the prog though, IM HOPING!! THANK YOU 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread conny . ledin
I have sent it to you now. Thanks for looking at it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread conny . ledin
i just mailed it to you. Thanks for looking at it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread Ben Sizer
connyledin wrote:
 Im trying to create a version of the game Wumpus. Mine is called
 Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can
 some one help me??
 here is the file:
 http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

 What i have the biggest problems with now is between line 8 and 23.

Perhaps you could post those lines so we get an idea of what's going
wrong. You also really need to explain what exactly you are hoping to
achieve, and in what way it isn't working. I don't think anybody is
likely to give you a full solution because that would defeat the
object.

-- 
Ben Sizer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread Claudio Grondi
Ben Sizer wrote:
 connyledin wrote:
 
Im trying to create a version of the game Wumpus. Mine is called
Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can
some one help me??
here is the file:
http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

What i have the biggest problems with now is between line 8 and 23.
 
 
 Perhaps you could post those lines so we get an idea of what's going
 wrong. You also really need to explain what exactly you are hoping to
 achieve, and in what way it isn't working. I don't think anybody is
 likely to give you a full solution because that would defeat the
 object.
 
I have trouble to get rid of the impression, that the (hidden from 
direct detection) goal of the original posting is some kind of promotion.

Claudio
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread conny . ledin
the thing is that im too much of a beginner to oint exactly to whats my
problem is... =( I need help by someone looking at the program and
presenting the solution... Im lousy, i should have choosen an easier
assignment.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-26 Thread [EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:
 i just mailed it to you. Thanks for looking at it.

Returning.

Comments added by me start #m.

I tried to keep all your original lines commented out and
added my fixes with #m on either side, but there were
so many errors I had to give up. I tried to preserve the
code of the first mistake and simply deleted multiple
repetitions of the same mistake.

Note I made a couple structural changes, move some
variables and deleted others. This in addition to fixing
the goofy errors you made trying to move to the
next room.

Movement now works correctly (I think, did not verify
the map, it doesn't allow you to go back the way you
came). In addition to now correctly printing the room
number, I added the room contents in square brackets.
You'll need to know that in order to handle the traps.

You've got a lot of code still commented out, better
get moving.

# -*- coding: cp1252 -*-
#Belzebub
#Conny Ledin

import random
from Tkinter import *

#creates a room class
class room(object):#,trap):
def __init__(self, trap):
self.trap = trap
#inserts content in rooms
#m
#m why do you need get_trap()?
#m room_list[current_room].trap will return the trap content
#m
def get_trap():
return trap

#creates a room list with content
room_list = []
#0=Nothing, 1=fire trap, 2=acid trap, 3=teleporter, 4=belzebub
trap_list = [0,0,0,0,0,0,0,0,0,1,1,2,2,3,3,3,3,3,3,4]
random.shuffle(trap_list)
for i in range(0,20):
r = room(trap_list[i]) #crates a room object whith content (trap)
room_list.append(r)

#creates a list with rooms
nextto_list1 = range(0,20)

#shuffles the list with rooms for movement in east/west direction
random.shuffle(nextto_list1)

#shuffles another list with rooms for movement in north/south direction
#m
#m this line doesn't work, nextt0_list2==None
#m nextto_list2 = random.shuffle (nextto_list1)
#m
nextto_list2 = range(0,20)
random.shuffle(nextto_list2)
#m


#m placed here, current_room is a global variable
current_room = 0
#m

root = Tk()

#creates GUI
class application(Frame):

def __init__(self, master):
#creates frame
Frame.__init__(self, master)
self.grid()
self.create_widgets()

def create_widgets(self):
Label(self,text = Whats your next move?).grid(row = 0, column
= 0, sticky = W)
Label(self, text = Choose one: ).grid(row = 1, column = 0,
sticky = W)
self.choice = StringVar()
#creates text box
self.results_txt = Text(self, width = 60, height = 10, wrap =
WORD)
self.results_txt.grid(row = 7, column = 0, columnspan = 4)
#creates radiobutton for north
Radiobutton(self, text = Go North,
variable = self.choice,
value = north,
command = self.move
).grid(row = 2, column = 0, sticky = W)
#creates radiobutton for east
Radiobutton(self, text = Go East,
variable = self.choice,
value = east,
command = self.move
).grid(row = 3, column = 0, sticky = W)
#creates radiobutton for south
Radiobutton(self, text = Go South,
variable = self.choice,
value = south,
command = self.move
).grid(row = 4, column = 0, sticky = W)
#creates radiobutton for west
Radiobutton(self, text = Go West,
variable = self.choice,
value = west,
command = self.move
).grid(row = 5, column = 0, sticky = W)
#creates radiobutton for shooting
Radiobutton(self, text = Deploy bomb,
variable = self.choice,
value = shoot,
command = self.shoot
).grid(row = 6, column = 0, sticky = W)

#creates a function for movement
def move(self):
#m tell move() that current_room is a global and not local
#m  to this block
global current_room
#m
message = 
message += self.choice.get()
print message
if message == north:
#m I modified next_room to pass the direction, you don't need it saved
#m  direction = 2
#m
#m next_room() returns the new room index, but you aren't saving it,
#m  so it's being lost
#m  next_room()
#m
#m ok, that's better, you're trying to save it, but what you
#m  forgot the (), so you're saving the location of the function,
#m  not calling it. note we can't make that mistake if we have to pass
#m  parameters to the function
#m  current_room = next_room
current_room = next_room(current_room,2)
#m
message = You enter the next room to the north 
message += str(current_room)
#m show what's in the room
message += ' [' + str(room_list[current_room].trap) + ']'
#m
if message == south:
#m
current_room 

I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-25 Thread connyledin
Im trying to create a version of the game Wumpus. Mine is called 
Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can 
some one help me??
here is the file:
http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

What i have the biggest problems with now is between line 8 and 23. 
How i can move the character trough the game. Other parts of the game 
that have with the movement to do is between line 83-114 and 123-143.

This is part of the spec:
The player walks around in the hallways, finds and tries to kill 
Wumpus (Belzebub). The game finishes when the player or Belzebub dies.
 The player has bombs which he can shoot. When he shoots he can 
controll th ebombs for three moves, north, south, east or west three 
times. If he is not careful he can shoot himself, ex first move: 
north. second move south.
 Let every room be represented by the object room. In the object, 
information of what exists in the room is stored. (Belzebub, 
teleporters, fire traps, acid traps or nothing). and where the 
halways leads. (north hallway leads to room 17, the east to room 2 
etc.). Create a list of room objects to represent the hallways (every 
room have has a number). 
 The content of the rooms shall be randomized in the beginning of 
the program. Aproximatly 20% of the rooms should contain traps, 30% 
should contain teleporters and in one of the rooms is Belzebub. One 
room can not contain more than one danger, no traps and teleporters 
together etc. 
 Teleporters transports the player from one room to another 
random room. If the player encounters a trap o Belzebub he is killed 
and GAME OVER.
 The halways should also be randomized in the beginning of the 
program. Like this:

* Create a list with all the room numbers and shuffle it so all of 
the rooms is in a mixed order. ex. [5 2 12 18 9 1 3 6 14 19 11 7 17 4 
20 16 10 15 8 13]

* Connect the rooms in east-west direction so that the east hallway 
from room 5 leads to room 2 and the west hallway from room to leads 
back to room 5 etc. The last room in the lest should be connected 
with the first.

* Shuffle a new list and do the same thing in north-south direction.

Once again the file: http://esnips.com/webfolder/b71bfe95-d363-4dd3-
bfad-3a9e36d0





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-25 Thread [EMAIL PROTECTED]

connyledin wrote:
 Im trying to create a version of the game Wumpus. Mine is called
 Belzebub. But im STUCK! And its due tuesday 2 maj. Im panicing! Can
 some one help me??
 here is the file:
 http://esnips.com/webfolder/b71bfe95-d363-4dd3-bfad-3a9e36d0

 What i have the biggest problems with now is between line 8 and 23.
 How i can move the character trough the game. Other parts of the game
 that have with the movement to do is between line 83-114 and 123-143.

 This is part of the spec:
 The player walks around in the hallways, finds and tries to kill
 Wumpus (Belzebub). The game finishes when the player or Belzebub dies.
  The player has bombs which he can shoot. When he shoots he can
 controll th ebombs for three moves, north, south, east or west three
 times. If he is not careful he can shoot himself, ex first move:
 north. second move south.
  Let every room be represented by the object room. In the object,
 information of what exists in the room is stored. (Belzebub,
 teleporters, fire traps, acid traps or nothing). and where the
 halways leads. (north hallway leads to room 17, the east to room 2
 etc.). Create a list of room objects to represent the hallways (every
 room have has a number).
  The content of the rooms shall be randomized in the beginning of
 the program. Aproximatly 20% of the rooms should contain traps, 30%
 should contain teleporters and in one of the rooms is Belzebub. One
 room can not contain more than one danger, no traps and teleporters
 together etc.
  Teleporters transports the player from one room to another
 random room. If the player encounters a trap o Belzebub he is killed
 and GAME OVER.
  The halways should also be randomized in the beginning of the
 program. Like this:

 * Create a list with all the room numbers and shuffle it so all of
 the rooms is in a mixed order. ex. [5 2 12 18 9 1 3 6 14 19 11 7 17 4
 20 16 10 15 8 13]

 * Connect the rooms in east-west direction so that the east hallway
 from room 5 leads to room 2 and the west hallway from room to leads
 back to room 5 etc. The last room in the lest should be connected
 with the first.

 * Shuffle a new list and do the same thing in north-south direction.

 Once again the file: http://esnips.com/webfolder/b71bfe95-d363-4dd3-
 bfad-3a9e36d0

Once again, that's not a file. And enclose your URLs in , that way
Google won't split them.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-25 Thread conny . ledin
the file is on that side. But apparently you have to register to
download it.. =(  But i can send it to anone who is willing to look
trough it. just send me an email [EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I have problems with creating the classic game Wumpus. the file: http://esnips.c

2006-04-25 Thread [EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:
 the file is on that side. But apparently you have to register to
 download it.. =(  But i can send it to anone who is willing to look
 trough it. just send me an email [EMAIL PROTECTED]

Ok, e-mail it to me.

But I cannot guarantee anything. I'll peruse it at my leisure.

-- 
http://mail.python.org/mailman/listinfo/python-list