Search Results

Showing results 1 to 40 of 143
Search took 0.03 seconds.
Search: Posts Made By: Murtan ; Forum: Python and child forums
Forum: Python Sep 30th, 2009
Replies: 3
Views: 550
Posted By Murtan
Please use code tags when posting code

You will need to re-input the health inside the loop so that it will ask the user for the health again. I suspect the current version outputs the 'health...
Forum: Python Sep 29th, 2009
Replies: 2
Views: 565
Posted By Murtan
I can't find the examples right now, but I recall modifying the setup.py to perform a search for some DLLs and using the path I found in the data section.

so instead of the constant string...
Forum: Python Jul 29th, 2009
Replies: 1
Views: 169
Posted By Murtan
The code you posted wouldn't even compile, let alone run.

Please be specific in the problem you are having.

I think the following is close to what you wanted, but it uses global variables which...
Forum: Python Apr 9th, 2009
Replies: 3
Views: 323
Posted By Murtan
If the coordinates were tuple (instead of lists) python would compare the values correctly:


a = [(1,2),(2,0)]
b = (2,0)
aa = a[1]
# now aa == b returns True

#alternatively, though probably...
Forum: Python Apr 9th, 2009
Replies: 3
Views: 323
Posted By Murtan
You're having an entity vs value comparison issue:


a = [[1,2],[2,0]]
b = [2,0]
aa = a[1]
# at this point, b = [2,0] and aa = [2,0]
# but aa == b returns False

# aa[0] == b[0] returns True
Forum: Python Mar 31st, 2009
Replies: 12
Views: 750
Posted By Murtan
Maybe you should look at the python bit-wise operators in the Python Docs (http://docs.python.org/reference/expressions.html#binary-bitwise-operations)
Forum: Python Mar 16th, 2009
Replies: 5
Views: 564
Posted By Murtan
Were you using the formula from page 8 of the pdf?

Shouldn't it be more like this?

return (0.0 + c - min(a, b)) / max(a, b)


I could be wrong, it wouldn't be the first time (grin).
Forum: Python Mar 13th, 2009
Replies: 3
Views: 502
Posted By Murtan
Your posted code did have tags, but if you use the language specific tags for example, you get line numbers and syntax highlighting as well. The syntax highlighting makes the code easier to read...
Forum: Python Mar 12th, 2009
Replies: 3
Views: 502
Posted By Murtan
First, the directory structure shown by walk doesn't quite appear to match what you said the structure would be.

For example, the directories under Library appear to be prefixed with a number (as...
Forum: Python Mar 9th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
I was working on revamping the code...most of it would need changes to work with the classes.
Forum: Python Mar 8th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
Ok, I'm going to post this...I've started it several times and then you post a significant rewrite of your code and to help you I have to toss this stuff out.

You can use the idea and expand on...
Forum: Python Mar 8th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
The lines:


self.weapons[1:"Steel Knuckles",2:"Knife",3:"Sword",4:"Gun",5:"Rocket Launcher"]
self.armors[1:"Leather Jacket",2:"Padded Sweater",3:"Iron Arm-shield",4:"Bullet-Proof...
Forum: Python Mar 7th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
Line 242 (line 2 in the fragment):


elif self.deposit <= self.money:
self.bankbalance = self.money - self.deposit
self.money = self.money - self.deposit
print"Your new bank Balance...
Forum: Python Mar 7th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
If you're having a problem with part of the code, please be specific as to what the problem is. What did you see? What did you expect to see?

If it is a compile problem, include the full text of...
Forum: Python Mar 6th, 2009
Replies: 2
Views: 295
Posted By Murtan
Ok, just to make sure I understand, you're running on computer A and can telnet to computer B. You want computer B to telnet to computer C?

Why not telnet from computer A to computer C directly?
...
Forum: Python Mar 6th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
The saved games should not change the code, but if you posted the file with the saved game in it, we should be able to save it and have the game load it like it was our saved game.
Forum: Python Mar 5th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
I meant the second code fragment in post 32 (http://www.daniweb.com/forums/post819042-32.html) where I posted you an entire file full of working code. The code isn't a fully complete version, but it...
Forum: Python Mar 5th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
What if we changed decode?

def decode(loc):
## Funktion för att översätta user input från A4 till listindex.
## den skall returnera -1 om platsen inte är giltig.
letter = loc[0].upper()
...
Forum: Python Mar 5th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
Line 96 should be:

self.e = self.eAttack()


The self.tnls on line 114 does not belong. It was moved to line 14.


(Why did you only copy part of the source when I went to the trouble to fix...
Forum: Python Mar 5th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
Lines 109-112 fill the list liobj with a Ruta created from the words in valdaord. This should only happen once.

When you call drawBoard, you should only pass liobj: drawBoard(liobj)

drawBoard...
Forum: Python Mar 5th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
I'm not sure what prompted you to turn the whole thing into a class, but I'll go with it if that's what you want to do.

It was said earlier, but ALL of the functions in the class need to have self...
Forum: Python Mar 5th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
The 'funny' part is, that you don't really have to split the loc at all and the decode prototype (with only one loc) was how I used it. All decode does is translate from 'a1' to 0, 'a2' to 1, 'a3' to...
Forum: Python Mar 4th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
Just because you 'could' do most of it in main doesn't mean you 'should'.

Start simple, write and test a simple function, make sure to give it both valid and invalid inputs. Make sure that it...
Forum: Python Mar 4th, 2009
Replies: 18
Views: 561
Posted By Murtan
I would like to better understand your vision for the project.

What are the project's goals?

When it is 'done' what do you see being able to do with it?

Who would be the intended users?
...
Forum: Python Mar 4th, 2009
Replies: 18
Views: 561
Posted By Murtan
Ok, so you appear to have some code there already. I don't see any notes there about what you want to do that needs more developers.

Where are you wanting to take the project that you would like...
Forum: Python Mar 4th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
Just as a side note, you could make the game a lot easier (potentially faster too) if you would let the user select things by number.

For example when selecting "battle" "shop" or "exit" if the...
Forum: Python Mar 4th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
When posting python code, please use python code tags

# Your code here


You didn't get everything that was supposed to be in main indented.

Here's the outline of how my code is...
Forum: Python Mar 3rd, 2009
Replies: 62
Views: 394,727
Posted By Murtan
PS- your player attack function:

def nAttack():
attack = random.randrange(10)+level*5
return attack
if w == 1:
attack = random.randrange(10)+20+level*5
elif w == 2:
...
Forum: Python Mar 3rd, 2009
Replies: 62
Views: 394,727
Posted By Murtan
you didn't want to keep indenting each new 'if level' test

They should all be at the same indent level, like if level == 1 and if level == 2 are.

(I had typed the following and thought I had...
Forum: Python Mar 2nd, 2009
Replies: 25
Views: 1,416
Posted By Murtan
I called that second part from the Ruta __init__:


wordsize = 7

def __init__(self, ord ):
self.ord = spacepad(ord, wordsize)
self.hidden = True
Forum: Python Mar 2nd, 2009
Replies: 62
Views: 394,727
Posted By Murtan
You can put the health reset in the main loop, just before the battle loop starts. You'll reset it more than you need to, but everyone will be full health when the battle starts.


while True:
...
Forum: Python Mar 2nd, 2009
Replies: 6
Views: 345
Posted By Murtan
Your goals are still VERY vague, but the bottom line is that for most peer-to-peer chat programs, you will open a socket between the two computers. Whether they hold the socket open (likely) or open...
Forum: Python Mar 1st, 2009
Replies: 62
Views: 394,727
Posted By Murtan
If you have all of the indenting right, I think that should be ok. If not, post the code along with the compiler error and we'll figure it out.
Forum: Python Mar 1st, 2009
Replies: 25
Views: 1,416
Posted By Murtan
Try this for the display:

print
# # ####### ####### ####### ####### ####### #######
print ' 1 2 3 4 5 6'
for row in range(6):
...
Forum: Python Mar 1st, 2009
Replies: 62
Views: 394,727
Posted By Murtan
The problem in the store is the mixing of assignment and test operators. You must use == for comparison and = for assignment.

You have:

if z == 1:
cost == 20
if money >=...
Forum: Python Mar 1st, 2009
Replies: 25
Views: 1,416
Posted By Murtan
Have you done anything with your program in the last couple of days?

Did you like any of the suggestions?

Normally, we like to give you advice and don't like to write your code for you. The...
Forum: Python Feb 28th, 2009
Replies: 62
Views: 394,727
Posted By Murtan
I would reset the player and monster health at the start of the battle.

The weapons would make a good class, the weapon has a name, a cost and an amount of damage. Then you could make a list of...
Forum: Python Feb 27th, 2009
Replies: 25
Views: 1,416
Posted By Murtan
Optionally, unless the requirements specifically require that you use a 6 by 6 matrix internally, the program could continue to store the grid in a single list. The internal program structure of your...
Forum: Python Feb 8th, 2009
Replies: 14
Views: 804
Posted By Murtan
My prototype (really simple -- uses 3 copies of the sample data you posted) seems to work ok. I do parse the first input file 4 times (once for each of the fields I want). Then for each remaining...
Forum: Python Feb 8th, 2009
Replies: 14
Views: 804
Posted By Murtan
So there will be 9126 columns of output (one extra for the headings)
and all of the values from one input file will be on one line in the output file?

Is the output file intended to be human...
Showing results 1 to 40 of 143

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC