From eec4cd1f37ccb353d325f7f8e46e6f9efaa02077 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Wed, 25 Jul 2012 10:58:30 -0400 Subject: [PATCH] Wasting less board space. --- 001/bin/life | 2 +- 001/src/life_time.erl | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/001/bin/life b/001/bin/life index 63d5437..a0f014a 100755 --- a/001/bin/life +++ b/001/bin/life @@ -1,7 +1,7 @@ #! /bin/sh -Y=`expr \`stty size | awk '{print $1}'\` - 5` +Y=`expr \`stty size | awk '{print $1}'\` - 3` X=`stty size | awk '{print $2}'` diff --git a/001/src/life_time.erl b/001/src/life_time.erl index 175321b..851aa05 100644 --- a/001/src/life_time.erl +++ b/001/src/life_time.erl @@ -17,11 +17,11 @@ ]). --define(INTERVAL, 100). % In milliseconds +-define(INTERVAL, 0). % In milliseconds -define(CHAR_DEAD, 32). % Space -define(CHAR_ALIVE, 111). % o --define(CHAR_BAR, 61). % = +-define(CHAR_BAR, 45). % - -record(state, {x :: integer() @@ -101,14 +101,15 @@ handle_cast({tock, {ID, CellState}}, NewGenCount = GenCount + 1, SortedStatePairs = lists:sort(NewStatePairs), StateChars = [state_to_char(S) || {_, S} <- SortedStatePairs], - ok = do_print_bar(X), + ok = io:format( "CELLS: ~b GENERATIONS: ~b~n", [NumCells, NewGenCount] ), ok = do_print_bar(X), + ok = do_print_state_chars(X, StateChars), - ok = do_print_bar(X), + ok = timer:sleep(?INTERVAL), schedule_next_tick(), {noreply, NewState#state{state_pairs=[], gen_count=NewGenCount}}; -- 2.20.1