commit 59c3f6e34e71ca255122943411a61856660cb32f Author: Joscha Date: Tue Apr 4 20:20:48 2017 +0000 Plan out project structure diff --git a/chunkdb.py b/chunkdb.py new file mode 100644 index 0000000..6c3b532 --- /dev/null +++ b/chunkdb.py @@ -0,0 +1,6 @@ +class ChunkDB(): + """ + Load and save chunks to a SQLite db. + """ + + pass diff --git a/chunks.py b/chunks.py new file mode 100644 index 0000000..5a4ec2d --- /dev/null +++ b/chunks.py @@ -0,0 +1,27 @@ +class ChunkDiff(): + """ + Represents differences between two chunks (changes to be made to a chunk). + Can be used to transform a chunk into another chunk. + """ + + pass + +class Chunk(): + """ + Represents a chunk (16x8 characters on the map). + Is able to generate diffs + - from another chunk + - from direct changes + - from accumulated changes + """ + + pass + +class ChunkPool(): + """ + Is a collection of chunks. + Allows user to manage (get, modify, delete) chunks, keeps track of chunks for them. + Load chunks it doesn't know. + """ + + pass diff --git a/client.py b/client.py new file mode 100644 index 0000000..5097bd4 --- /dev/null +++ b/client.py @@ -0,0 +1,36 @@ +import sys +import threading + +class Client(): + def __init__(self, address): + self.address = address + self.clock = threading.RLock() + #self.pool = Chunkpool() + #self.map_ = Map(sizex, sizey, self.pool) + #self.chunkmap = Chunkmap(sizex, sizey, self.pool) # size changeable by +/-? + + #self.sock = socket.Socket(...) + + def launch(self): + # try to connect + # launch socket thread + # update display + # -> launch input thread + + def get_input(self, scr): + pass + + def stop(self): + pass + +def main(argv): + if len(argv) != 2: + print("Usage:") + print(" {} address".format(argv[0])) + return + + client = Client(argv[1]) + client.launch() + +if __name__ == "__main__": + main(sys.argv) diff --git a/clientchunkpool.py b/clientchunkpool.py new file mode 100644 index 0000000..cde947a --- /dev/null +++ b/clientchunkpool.py @@ -0,0 +1,8 @@ +from .chunks.py import ChunkPool + +class ClientChunkPool(ChunkPool): + """ + A ChunkPool that requests/loads chunks from a client. + """ + + pass diff --git a/dbchunkpool.py b/dbchunkpool.py new file mode 100644 index 0000000..52aee53 --- /dev/null +++ b/dbchunkpool.py @@ -0,0 +1,8 @@ +from .chunks.py import ChunkPool + +class DBChunkPool(ChunkPool): + """ + A ChunkPool that can load/save chunks from/to a database. + """ + + pass diff --git a/maps.py b/maps.py new file mode 100644 index 0000000..8bd833a --- /dev/null +++ b/maps.py @@ -0,0 +1,15 @@ +class Map(): + """ + A map which displays chunks and a cursor on the screen. + Allows for user to modify chunks in an intuitive way. + """ + + pass + +class ChunkMap(): + """ + A map that shows which chunks are currently loaded. + Might show additional details too (i.e. if a chunk has been modified). + """ + + pass diff --git a/server.py b/server.py new file mode 100644 index 0000000..e69de29