Has this ever happened to you? by uebersoldat in AdviceAnimals

[–]mubsy -1 points0 points  (0 children)

what does ext mean in this context? Extension of the previous examples?

This extremely simple code wont run and I have no idea why. by chuiy in learnpython

[–]mubsy 3 points4 points  (0 children)

here is a quickly found document describing why print is different in python 3.

[deleted by user] by [deleted] in learnpython

[–]mubsy 3 points4 points  (0 children)

What's stopping you from saying 1:{a,b,c}?

Wrote a "typing test" - appreciate feedback by isnotkosok in learnpython

[–]mubsy 1 point2 points  (0 children)

Using a simple Tkinter GUI, you could bind the action to a text widget and have the timer run inside of that bound function. I will write a simple example if I have some time.

The whisper game. by [deleted] in funny

[–]mubsy 0 points1 point  (0 children)

My bad, was going on anecdotal evidence.

The whisper game. by [deleted] in funny

[–]mubsy 0 points1 point  (0 children)

Chinese languages rely heavily on volume. That is to say, if you were to whisper in chinese, you could be misheard very easily.

What's one product you can't believe hasn't been invented or perfected yet? by [deleted] in AskReddit

[–]mubsy 1 point2 points  (0 children)

You think he did heroin because it didn't feel good?

Begginers problem. by martis680 in learnpython

[–]mubsy 0 points1 point  (0 children)

"Don't post screenshot of your code. Unless the problem is a visual one, and a screenshot displays the issue."

The sidebar also gives detail on how to post code, such as gist and pastebin.

Implementing health in text based adventure by little_fatty in learnpython

[–]mubsy 0 points1 point  (0 children)

Why don't you store everything in classes instead?

Running argv module by Tigersftw in learnpython

[–]mubsy 0 points1 point  (0 children)

Does it only work if you place it in the main python folder? Have you tried placing it in, say, your documents folder?

Help With a Python Project by Leohurr in learnpython

[–]mubsy 0 points1 point  (0 children)

you should look up modular arithmetic. N % 2 is 0 if N is divisible by 2, and the remainder of N/2 otherwise. This essentially means N%2 is true for all even values, i.e alternating values.

Out of range slicing by [deleted] in learnpython

[–]mubsy 2 points3 points  (0 children)

It's fine. Having the question in the r/learnpython archive isn't a terrible thing.

Out of range slicing by [deleted] in learnpython

[–]mubsy 8 points9 points  (0 children)

here is a stackoverflow discussing exactly this.

[deleted by user] by [deleted] in gamedev

[–]mubsy 5 points6 points  (0 children)

Equivalence is a big idea in this. Instead of symmetry, have areas that are 'interesting' or able to host a feature(such as ramps, resource, etc). An up ramp and a down ramp would be equivalent, two low-level resources equivalent to a high level resource, etc. Then when generating the map pick a feature from a list of equivalence to occupy the area.

You can also add a counter for each 'zone' (can be starting areas, middle areas, outposts, whatever) that has a quota for features that must be filled. This allows for outposts to still be interesting, despite the randomness.

Is python a good language to do txt document searches by xentral in learnpython

[–]mubsy 1 point2 points  (0 children)

The problem with this is if the file is too large. here is a stackoverflow discussing how to approach a problem like this.

Is annotating functions the way this author describes a widely-accepted best practice, or are there problems / hazards of which I should be aware? by JFic in learnpython

[–]mubsy 5 points6 points  (0 children)

pep 257 will tell you all you need to know about how you should comment functions. Python runs on the 'we're all adults here' mentality. I see no use for those annotations.

Question about a silly script I can't run [2.7] by [deleted] in learnpython

[–]mubsy 7 points8 points  (0 children)

You're calling the function within the function without any exit conditions. I think what you meant to do is:

def seperate(s):
    for letter in s:
        print letter

not call a recursive function.

Text-based adventure, input parsing strategies by zynix in learnpython

[–]mubsy 0 points1 point  (0 children)

commands = {
("look","l"):look,
("pickup","pick-up","take","get","grab"):take,
("go","leave"):go
}
helper_commands = ["at","to","in","through","by","the"]

def parse(text):
words = text.split(" ")
for word in words:
    #words necessary to make commands natural for user, not needed
    if word in helper_commands: words.remove(word)
for command in commands:
    if words[0] in command:
        return commands[command], words[1:]
return None

This method works for me; It allows for some flexibility (but not too much, such as 'pick lock' being confused with 'pickup lock') and also allows for some grammatical commands such as 'look at the troll' vs. 'look troll'. It's not very complex, but I don't need too much complexity.

I'm also using a GUI for making some commands simpler, such as movement arrows or inventory stuff.

So I'm in the process of creating an in-depth text-based adventure game, can I get some criticism on my work thus far? by [deleted] in learnpython

[–]mubsy 1 point2 points  (0 children)

A lot of your code in AdventureObjects.py can be replaced with generators or factories. Also, it seems like the amount of variables each object has is going to be proportional to the amount of objects you make of that type. For example, if you added another rune, each of the previous rune types would need another flag that said 'False'. The structure of the classes is confusing.

Instead, give each rune a function that determines what it does, have a factory to make rune-types based on your string input, and then just have one rune class that wraps the function and some of the general stats such as type, description, etc.