#!/usr/bin/env python

from ookoobah import core
from ookoobah import session
from ookoobah import utils

grid = utils.make_grid_from_string("""
    # # # # # #
    # > . . \ #
    # . # . | #
    # . / | o #
    # . \ . / #
    # # # # # #
""")

sess = session.Session(grid=grid)
sess.start()

print "<enter> to render next; <r> to reset; ^C to abort"

status = core.Game.STATUS_ON
while status == core.Game.STATUS_ON:
    print utils.dump_game_to_string(sess.game)
    status = sess.game.step()
    if raw_input() == "r":
        sess.reset()
        sess.start()

print "game status: %s" % status

#!/usr/bin/env python

from ookoobah import core
from ookoobah import utils

grid = utils.make_grid_from_string("""
    # # # # # #
    # > . . \ #
    # . # . | #
    # . / | o #
    # . \ . / #
    # # # # # #
""")

game = core.Game(grid=grid)
game.start()

print "hit <enter> to render next; ^C to abort"

status = core.Game.STATUS_ON
while status == core.Game.STATUS_ON:
    print utils.dump_game_to_string(game)
    status = game.step()
    raw_input()

print "game status: %s" % status

--- 
+++ 
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 from ookoobah import core
+from ookoobah import session
 from ookoobah import utils
 
 grid = utils.make_grid_from_string("""
@@ -12,15 +13,17 @@
     # # # # # #
 """)
 
-game = core.Game(grid=grid)
-game.start()
+sess = session.Session(grid=grid)
+sess.start()
 
-print "hit <enter> to render next; ^C to abort"
+print "<enter> to render next; <r> to reset; ^C to abort"
 
 status = core.Game.STATUS_ON
 while status == core.Game.STATUS_ON:
-    print utils.dump_game_to_string(game)
-    status = game.step()
-    raw_input()
+    print utils.dump_game_to_string(sess.game)
+    status = sess.game.step()
+    if raw_input() == "r":
+        sess.reset()
+        sess.start()
 
 print "game status: %s" % status
test: Switch to Session from a bare Game
