Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 21st, 2007, 6:05 PM   #1
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
Talking Phoenix Engine.NET

This is my first crack at making a game maker, so i would be glad if anyone here can test my engine and post some feedback on the blog. Thanks :-)

Link: http://phoenixengine.blogspot.com/
Master is offline   Reply With Quote
Old Mar 21st, 2007, 6:15 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,030
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Quick comment about your site:

http://www.iomegatrix.com/Downloads/code.txt

I don't think your Python code does what your Ruby code does. It doesn't even compile.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges!
Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download.
Sane is online now   Reply With Quote
Old Mar 21st, 2007, 6:46 PM   #3
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
Thanks for letting me know, i have updated it. The problem was because i did not tab the code.
Master is offline   Reply With Quote
Old Mar 21st, 2007, 7:05 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,030
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
It's still wrong. You have return s on the wrong identation level. Plus you're doing some other whacky things. Why do you append to the string for all clauses except the else clause?

class Point:

    def __init__(self, x = 0, y = 0):
        self.x , self.y = x, y

    def __str__(self):
        if (self.x < 0) : 
            s = "a value in is too small"
        elif (self.x > -1 and self.y > -1):
            s = "x = " + str(self.x) + " y = " + str(self.y)
        else:
            s = "<Point " + str(self) + " >"
        return s

mypoint = Point()
# print str(mypoint)

But I don't even know what the Ruby code does... so, meh.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges!
Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download.
Sane is online now   Reply With Quote
Old Mar 21st, 2007, 10:08 PM   #5
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
Quote:
Originally Posted by Sane View Post
It's still wrong. You have return s on the wrong identation level. Plus you're doing some other whacky things. Why do you append to the string for all clauses except the else clause?

class Point:

    def __init__(self, x = 0, y = 0):
        self.x , self.y = x, y

    def __str__(self):
        if (self.x < 0) : 
            s = "a value in is too small"
        elif (self.x > -1 and self.y > -1):
            s = "x = " + str(self.x) + " y = " + str(self.y)
        else:
            s = "<Point " + str(self) + " >"
        return s

mypoint = Point()
# print str(mypoint)

But I don't even know what the Ruby code does... so, meh.
I tested the code and it works . The s on the right indent. The point of the code is to show how to use if and else compare to ruby. Some part of the code is not need but to show an example.

The sample is basically a point class, which can be used to store x and y point. And when the #toString method is called, it print what ever result is set for the to_s in ruby and calls __str__ for python.
Master is offline   Reply With Quote
Old Mar 21st, 2007, 10:17 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,030
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Uhhh... if you don't return s, str(my_point) will display a nullified NoneType variable. No s is being returned for the default case of (x, y) = (0, 0).

Run your code with the line "print str(mypoint)" at the bottom:

>>> print str(mypoint)
TypeError: __str__ returned non-string (type NoneType)

My version of your code shows the (presumably) correct output:

>>> print str(mypoint)
x = 0 y = 0
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges!
Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download.
Sane is online now   Reply With Quote
Old Mar 21st, 2007, 11:06 PM   #7
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
Can you post it. I will be glad to update it
Master is offline   Reply With Quote
Old Mar 21st, 2007, 11:32 PM   #8
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,030
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
I already did.
__________________
Looking for tough programming challenges? Try participating in Sane's Monthly Algorithms Challenges!
Composing Techno is a little side hobby of mine. Techno by DJ Sane. All free for download.
Sane is online now   Reply With Quote
Old Mar 22nd, 2007, 4:27 PM   #9
Master
Programmer
 
Master's Avatar
 
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4 Master is on a distinguished road
Sorry, i did not realized it
Master is offline   Reply With Quote
Old Mar 25th, 2007, 5:26 PM   #10
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
You are also missing out on one common python idiom, iteration. You do this:
python Syntax (Toggle Plain Text)
  1. for i in range(0, len(Players)):
  2. player = Players[i]
  3. # loop code ...
When you should go:
python Syntax (Toggle Plain Text)
  1. for i, player in enumerate(Players):
  2. # loop code ...
__________________
Robotics @ Maryland AUV Team - Software Lead
Game_Ender is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[C#] Phoenix - freeware delivery system g3cka Paid Job Offers 14 Jan 2nd, 2007 6:29 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:01 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC