summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2007-12-16 23:51:51 +0100
committerGuillaume Seguin <guillaume@segu.in>2007-12-16 23:51:51 +0100
commit4e378cb7f808bf1f7b0b601e6b6635cb8bdc45c1 (patch)
tree9ab2b283605f6d2fc4a6f9165abbf737515a488c
parent95c4f9c75945d3e8f5939393ba23ef1e48294ff8 (diff)
downloadtsp-4e378cb7f808bf1f7b0b601e6b6635cb8bdc45c1.tar.gz
tsp-4e378cb7f808bf1f7b0b601e6b6635cb8bdc45c1.tar.bz2
* Minor refactoring of default configuration handling
-rwxr-xr-xtsp.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tsp.py b/tsp.py
index 5ccef41..5b7d7fc 100755
--- a/tsp.py
+++ b/tsp.py
@@ -42,13 +42,14 @@ OFFSET_Y = 20
CITY_RADIUS = 3
-DEFAULT_COUNT = 100
-
SHOW_NAMES = True
ALGOS = ["2opt"]
COUNTS = [8, 10, 25, 50, 100, 250]
+DEFAULT_ALGO = "2opt"
+DEFAULT_COUNT = 50
+
class Color:
def __init__ (self, r, g, b):
@@ -327,11 +328,11 @@ class AlgoGui (gtk.Window):
hbox = gtk.HBox ()
self.algo_box = gtk.combo_box_new_text ()
map (self.algo_box.append_text, ALGOS)
- self.algo_box.set_active (ALGOS.index ("2opt"))
+ self.algo_box.set_active (ALGOS.index (DEFAULT_ALGO))
hbox.pack_start (self.algo_box, False, False)
self.count_box = gtk.combo_box_new_text ()
map (lambda i: self.count_box.append_text ("%d cities" % i), COUNTS)
- self.count_box.set_active (COUNTS.index (25))
+ self.count_box.set_active (COUNTS.index (DEFAULT_COUNT))
hbox.pack_start (self.count_box, False, False)
self.gen_button = gtk.Button ("Generate")
self.gen_button.connect ("clicked", self.generate)