DEATH

a multiplayer variant of conways game of LIFE
git clone https://git.ce9e.org/DEATH.git

commit
748a59da17fce65b6eb07163e1057992fcb05ae8
parent
30959f6d0543f9e3c385620f314b0d9b52e0474e
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2011-03-11 07:38
counter

Diffstat

R death_cli.py -> DeathCli.py 9 ++++++---
A DeathCli.pyc 0
R death_cli_menu.py -> DeathCliMenu.py 4 ++--
A RULES 4 ++++
M death.py 6 ++++++
A death.pyc 0
A log 0
M matrix.py 7 ++++++-
A matrix.pyc 0

9 files changed, 24 insertions, 6 deletions


diff --git a/death_cli.py b/DeathCli.py

@@ -29,7 +29,7 @@ escape     - return to menu
   29    29 return with any key
   30    30 """
   31    31 
   32    -1 class Crs:
   -1    32 class DeathCli:
   33    33   global help
   34    34 
   35    35   def __init__(self, death=Death(), screen=curses.initscr()):
@@ -59,6 +59,8 @@ class Crs:
   59    59       self.screen.addstr(y0+y, x0-1, '|', curses.color_pair(2))
   60    60       self.screen.addstr(y0+y, x0+w, '|', curses.color_pair(2))
   61    61     self.screen.addstr(y0+h, x0+w, str(self.death.id+1), curses.color_pair(2))
   -1    62     # count
   -1    63     self.screen.addstr(y0-1, x0+2, '|'.join([str(a) for a in self.death.count()]), curses.color_pair(2))
   62    64     # map
   63    65     for i in range(self.death.map.rows):
   64    66       for j in range(self.death.map.cols):
@@ -110,7 +112,8 @@ class Crs:
  110   112 
  111   113          
  112   114 if __name__ == '__main__':
  113    -1   try: Crs()
  114    -1   except: pass
   -1   115   try: DeathCli()
   -1   116   except Exception as ex:
   -1   117    print ex
  115   118   curses.endwin()
  116   119 

diff --git a/DeathCli.pyc b/DeathCli.pyc

Binary files differ.

diff --git a/death_cli_menu.py b/DeathCliMenu.py

@@ -2,7 +2,7 @@
    2     2 # -*- coding: utf-8 -*-
    3     3 
    4     4 import curses
    5    -1 import death_cli
   -1     5 from DeathCli import DeathCli
    6     6 from death import Death
    7     7 from matrix import Map
    8     8 
@@ -169,7 +169,7 @@ class Crs:
  169   169 
  170   170     _map = Map(rows, cols)
  171   171     d = Death(_map, n, alive, born, kill)
  172    -1     death_cli.Crs(d, self.screen)
   -1   172     DeathCli(d, self.screen)
  173   173     return True
  174   174 
  175   175 if __name__ == '__main__':

diff --git a/RULES b/RULES

@@ -0,0 +1,4 @@
   -1     1 statische grenzen -> wer bekommt mehr gebiet?
   -1     2 zb
   -1     3 012345678|34|345678
   -1     4 01234567|34|345678

diff --git a/death.py b/death.py

@@ -58,3 +58,9 @@ class Death:
   58    58     if self.id == self.n:
   59    59       self.id = 0
   60    60 
   -1    61   def count(self):
   -1    62     c = []
   -1    63     for id in range(self.n):
   -1    64       c.append(self.map.count(id+1))
   -1    65     return c
   -1    66 

diff --git a/death.pyc b/death.pyc

Binary files differ.

diff --git a/log b/log

diff --git a/matrix.py b/matrix.py

@@ -39,17 +39,22 @@ class Matrix:
   39    39 
   40    40   def count(self, _item):
   41    41     c = 0
   42    -1     for row in rows:
   -1    42     for row in self.data:
   43    43       for item in row:
   44    44         if item == _item:
   45    45           c += 1
   46    46     return c
   47    47 
   48    48   def save(filename, seperator=';'):
   -1    49     f = open(filename, 'w')
   -1    50     f.write('bla')
   49    51     pass # TODO
   -1    52     f.close()
   50    53 
   51    54   def load(filename, seperator=';'):
   -1    55     f = open(filename, 'r')
   52    56     pass # TODO
   -1    57     f.close()
   53    58 
   54    59 class Map(Matrix):
   55    60   def __init__(self, rows=15, cols=15, diagonal=True, value=0):

diff --git a/matrix.pyc b/matrix.pyc

Binary files differ.