Forum: Coder's Corner Lounge
Dec 30th, 2007, 8:13 AM
|
|
Replies: 38
Views: 1,174
|
Forum: Coder's Corner Lounge
Dec 30th, 2007, 8:12 AM
|
|
Replies: 38
Views: 1,174
|
Forum: Coder's Corner Lounge
Dec 30th, 2007, 7:31 AM
|
|
Replies: 38
Views: 1,174
|
Forum: Coder's Corner Lounge
Dec 30th, 2007, 7:19 AM
|
|
Replies: 38
Views: 1,174
|
Forum: Coder's Corner Lounge
Dec 10th, 2007, 12:01 AM
|
|
Replies: 13
Views: 416
|
Forum: Python
Dec 9th, 2007, 7:53 AM
|
|
Replies: 11
Views: 360
Re: name error
To give a little more detail, when you indent something in Python, you're saying it belongs to a block.
class Foobar:
n = 10 # This variable belongs to the class Foobar
def...
|
Forum: Python
Dec 8th, 2007, 9:43 AM
|
|
Replies: 11
Views: 360
Re: name error
Er, you've still got the code tags wrong. Don't encase every line, just the whole block.
I've taken the liberty of doing this for you:
class Ship(games.Sprite):
"""The player's ship."""
...
|
Forum: Community Introductions
Dec 4th, 2007, 3:32 AM
|
|
Replies: 17
Views: 796
|
Forum: Show Off Your Open Source Projects
Nov 30th, 2007, 6:59 AM
|
|
Replies: 4
Views: 416
Re: Small compiler in Haskell
I get what you're saying - I recently wrote a basic Lisp interpreter in Python, and I deliberately avoided all of the parsing libraries.
By the way, the way your program compiles into assembly is...
|
Forum: Python
Nov 29th, 2007, 10:04 AM
|
|
Replies: 2
Views: 228
|
Forum: Python
Nov 28th, 2007, 4:06 PM
|
|
Replies: 2
Views: 190
|
Forum: Show Off Your Open Source Projects
Nov 26th, 2007, 6:44 PM
|
|
Replies: 4
Views: 416
|
Forum: Coder's Corner Lounge
Oct 30th, 2007, 10:45 AM
|
|
Replies: 5
Views: 231
Re: Checking possible moves recursivley
I rather assumed that the square could move in any horizontal or vertical direction, and that this was more a path-finding problem than a collision detection problem. Otherwise, as you say, you...
|
Forum: Coder's Corner Lounge
Oct 30th, 2007, 5:39 AM
|
|
Replies: 5
Views: 231
Re: Checking possible moves recursivley
Just keep recursing until:
a) You hit a wall
b) You run out of unexplored spaces
c) You hit some internal limit on how far the function should explore
Presumably you're only interested in places...
|
Forum: Other Programming Languages
Oct 25th, 2007, 11:40 AM
|
|
Replies: 17
Views: 815
|
Forum: HTML / XHTML / CSS
Oct 21st, 2007, 5:02 PM
|
|
Replies: 32
Views: 1,570
Re: Why is CSS such a mess?
Bolded text may carry both presentation and content information, but that's why the humble <b> tag is depreciated. There's no reason why the meaning behind a tag can't be separated from it's...
|
Forum: HTML / XHTML / CSS
Oct 20th, 2007, 5:19 AM
|
|
Replies: 32
Views: 1,570
Re: Why is CSS such a mess?
I tend to agree with Dameon on this. CSS is pretty awful at layout. Sure, you can get around it with numerous "two column" techniques, but if CSS was designed properly, then it would be much more...
|
Forum: Coder's Corner Lounge
Oct 19th, 2007, 4:31 AM
|
|
Replies: 17
Views: 665
|
Forum: Python
Oct 13th, 2007, 8:42 PM
|
|
Replies: 44
Views: 2,001
I still can't quite see why you object so...
I still can't quite see why you object so strongly to inheritance, as in many situations it provides a much cleaner solution than the procedural approach. For instance, take the following...
|
Forum: Python
Oct 13th, 2007, 5:27 PM
|
|
Replies: 44
Views: 2,001
|
Forum: Python
Oct 12th, 2007, 8:37 PM
|
|
Replies: 44
Views: 2,001
You seem to be labouring under the assumption...
You seem to be labouring under the assumption that you need a language specifically created for OOP, which, as DaWei has pointed out several times in the past, is simply not the case.
You can write...
|
Forum: Python
Oct 12th, 2007, 7:06 AM
|
|
Replies: 44
Views: 2,001
|
Forum: Python
Oct 11th, 2007, 1:00 PM
|
|
Replies: 8
Views: 1,017
Well, you're practically there, already!...
Well, you're practically there, already! :)
Let's go over what we have so far. We have the Euclidean function gcd, and the Extended Euclidean function ex_gcd.
Given the equation 75x + 42y = 6, we...
|
Forum: Python
Oct 11th, 2007, 12:06 PM
|
|
Replies: 8
Views: 1,017
|
Forum: Python
Oct 11th, 2007, 11:53 AM
|
|
Replies: 8
Views: 1,017
You probably want the Extended Euclidean...
You probably want the Extended Euclidean Algorithm (http://en.wikipedia.org/wiki/Extended_Euclidean_Algorithm). There's some useful pseudo-code down at the bottom of the linked Wikipedia article.
|
Forum: Python
Oct 11th, 2007, 6:07 AM
|
|
Replies: 44
Views: 2,001
|
Forum: Community Introductions
Oct 8th, 2007, 12:05 PM
|
|
Replies: 10
Views: 362
|
Forum: Python
Oct 7th, 2007, 12:48 PM
|
|
Replies: 44
Views: 2,001
When you have a small number of conditions in...
When you have a small number of conditions in Python, one uses an if-statement. But if there are a large number of conditions that follow a common pattern, it's easier to use a dictionary:
commands...
|
Forum: Python
Oct 7th, 2007, 6:02 AM
|
|
Replies: 44
Views: 2,001
Don't belittle yourself; adapting your way of...
Don't belittle yourself; adapting your way of thinking to a different programming technique is extremely difficult. Recently I've begun to delve into functional languages, and it initially took me...
|
Forum: Python
Oct 6th, 2007, 9:23 AM
|
|
Replies: 44
Views: 2,001
Pretty good, but if you want to label your...
Pretty good, but if you want to label your directions as "w", "e", "n" and "s", why not do something like:
foyer.exits["w"] = kitchen
kitchen.exits["e"] = foyer
me = Player(foyer)
while True:
...
|
Forum: Python
Oct 5th, 2007, 12:51 PM
|
|
Replies: 44
Views: 2,001
|
Forum: Python
Oct 4th, 2007, 1:05 PM
|
|
Replies: 44
Views: 2,001
|
Forum: Coder's Corner Lounge
Oct 4th, 2007, 1:03 PM
|
|
Replies: 6
Views: 286
Interesting. But it looks like it's released...
Interesting. But it looks like it's released under a "read-only" license, which makes it somewhat dangerous to read. If you don't download the source, and then happen to write a piece of code that's...
|
Forum: Python
Oct 4th, 2007, 12:29 PM
|
|
Replies: 44
Views: 2,001
Perhaps you should try designing a simple...
Perhaps you should try designing a simple adventure game in the procedural style you're used to, then to try designing an identical game using an object orientated philosophy. This will give you an...
|
Forum: Python
Oct 4th, 2007, 6:57 AM
|
|
Replies: 44
Views: 2,001
Object orientation is more a philosophy than a...
Object orientation is more a philosophy than a certain piece of language functionality. Objects group together related functions and objects into a single package, allowing the developer to organise...
|
Forum: Python
Oct 1st, 2007, 12:26 PM
|
|
Replies: 4
Views: 294
|
Forum: Ruby
Sep 26th, 2007, 10:49 AM
|
|
Replies: 2
Views: 428
|
Forum: Coder's Corner Lounge
Sep 23rd, 2007, 5:58 PM
|
|
Replies: 8
Views: 231
|
Forum: Coder's Corner Lounge
Sep 19th, 2007, 10:10 AM
|
|
Replies: 25
Views: 603
It's all very well to say that "most serious...
It's all very well to say that "most serious studies" support your argument, but I notice you don't actually provide references to any of these.
I could equally claim that there is a positive...
|
Forum: Coder's Corner Lounge
Sep 18th, 2007, 2:22 PM
|
|
Replies: 25
Views: 603
It's not arbitrary; rather, it's a recursive...
It's not arbitrary; rather, it's a recursive definition. A human being is self-aware; that is, it is capable of conceptualising its own existence. I believe that human lives are important, because...
|