about summary refs log tree commit diff stats
path: root/hanoi.teliva
diff options
context:
space:
mode:
Diffstat (limited to 'hanoi.teliva')
-rw-r--r--hanoi.teliva17
1 files changed, 9 insertions, 8 deletions
diff --git a/hanoi.teliva b/hanoi.teliva
index ea3b1d6..ba1d9cc 100644
--- a/hanoi.teliva
+++ b/hanoi.teliva
@@ -31,9 +31,9 @@ end
 local function render_disk(window, line, col, size)
   col = col-size+1
   for i=1,size do
-    window:attron(curses.color_pair(1))
+    window:attron(curses.color_pair(size))
     window:mvaddstr(line, col, "  ")
-    window:attroff(curses.color_pair(1))
+    window:attroff(curses.color_pair(size))
     col = col+2
   end
 end
@@ -42,17 +42,17 @@ local function render_tower(window, line, col, tower_index, tower)
   window:attron(curses.A_BOLD)
   window:mvaddch(line+2, col, string.char(96+tower_index))
   window:attroff(curses.A_BOLD)
-  window:attron(curses.color_pair(2))
+  window:attron(curses.color_pair(7))
   window:mvaddstr(line+1, col-6, "              ")
-  window:attroff(curses.color_pair(2))
+  window:attroff(curses.color_pair(7))
   for i, n in ipairs(tower) do
     render_disk(window, line, col, n)
     line = line - 1
   end
   for i=1,5-len(tower)+1 do
-    window:attron(curses.color_pair(2))
+    window:attron(curses.color_pair(7))
     window:mvaddstr(line, col, "  ")
-    window:attroff(curses.color_pair(2))
+    window:attroff(curses.color_pair(7))
     line = line - 1
   end
 end
@@ -89,8 +89,9 @@ end
 
 local function main()
   local window = curses.stdscr()
-  curses.init_pair(1, 0, 2)
-  curses.init_pair(2, 0, 8)
+  for i=1,7 do
+    curses.init_pair(i, 0, i)
+  end
 
   while true do
     render(window)