class Node:
end = "."
start = "!"
def __init__(self,g,id,name,stop=False,start=False):
self.id = id
self.graph = g # where do i live?
self.name = name # what is my name?
self.description = "" # tell me about myself
self.stop = stop # am i a stop node?
self.start = start # am i a start node?
self.out = [] # where do i connect to
def also(self,txt):
"adds text to description"
sep = "\n" if self.description else ""
self.description += sep + txt
def __repr__(self):
return "N( :id " + str(self.id) + \
"\n :name " + self.name + \
"\n :about '" + self.description + "'" + \
"\n :out " + str(self.out) + ") "
I guess it has to be self.end=stop
--
You received this message because you are subscribed to the Google Groups "cs310" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cs310+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Can you specify why? My python IDE checks for shadowing of built in types, self.stop = stop should work. On node construction it is forced to "False", and then after you isolate the end node with your matrix you should explicitly set it as an end node "True" inside the node and set that node to self.stop inside of graph. Also, are you using python 2.7? Loudify Ubuntu like what we set up in class has python 3.3, 2.7 and others installed side by side, though I think 2.7 is supposed to be the default terminal python.
Not saying you're wrong, just asking you to clarify I suppose.
--
tmp.end = Node.end in name
I am using python 2.7 and when loading the graph I found my end node and set it to True for that node. Then when playing the game I used it to determine when to stop playing the game. By making sure my current node wasn't the end node.
"Node.end in name" returns a boolean value. Because it tests if a "." Is in the node name.
Jumping in a little late on this issue of the end node issue. If you change the line of code that reads
tmp.end = Node.end in name
To be:
tmp.end = Node.end in name
It fixed the stop node recognition issue, it was simply a type-o. I could not tell if you all already reached this solution and figured I would throw this out there; as this caused me a few hours of head aches when debugging