wm: glendy

Download patch

ref: ffd13429678415bae437f9156983c8d3b5770052
parent: 1295f0e6835eba2fc4d87bcf1e3435b7cc55b130
author: mkf <mkf@cloud9p.org>
date: Wed Apr 17 13:30:42 EDT 2024

import documents

--- /dev/null
+++ b/doc/glendy2.man
@@ -1,0 +1,138 @@
+.TH GLENDY 2
+.SH NAME
+initlevel, pointdir, movedir, domove,
+doput, findglenda, checknext, score1, clac, nextglenda,
+restart, undo, checkstate \- libglendy functions
+.SH SYNOPSIS
+.B #include "engine.h"
+.PP
+.B
+void initlevel(void);
+.PP
+.B
+Point movedir(int dir, Point p);
+.PP
+.B
+int pointdir(Point src, Point dst);
+.PP
+.B
+int domove(int dir, Point p);
+.PP
+.B
+int doput(Point p);
+.PP
+.B
+Point findglenda(void);
+.PP
+.B
+int checknext(int dir, Point p);
+.PP
+.B
+int score1(Point p);
+.PP
+.B
+void calc(void);
+.PP
+.B
+void nextglenda(void);
+.PP
+.B
+void restart(void);
+.PP
+.B
+void undo(void);
+.PP
+.B
+int checkstate(void);
+
+.SH DESCRIPTION
+These functions are used to deal with details of
+.I glendy
+(also known as cat trap)
+and make writing clients easier.
+
+.I initlevel
+sets up the map with glenda always on middle
+and amount of walls based on 
+.I difficulity
+variable,
+.TP 10
+.B DEasy
+	10 ≤ x ≤ 15
+.TP 10
+.B DMed
+	5 ≤ x ≤ 10
+.TP 10
+.B Dhard
+	1 ≤ x ≤ 5
+.TP 10
+.B DImp
+	x = 0
+.PP
+where 
+.B x
+is amount of walls, chosen randomly.
+
+.PP
+.I movedir
+function returns the point
+.I p
+after being moved in
+.I dir
+direction,
+or
+.B {-1, -1}
+in case of invalid input.
+.I pointdir
+is the reverse of
+.I movedir
+function, returning what direction
+.I src
+needs to be moved to reach
+.I dst
+or
+.B Err
+if it can't be reached in one move.
+
+.I domove
+and
+.I doput
+are used by clients to handle actions for glenda
+and trapper (the player who puts the walls).
+they
+returns
+.B Wall
+and
+.B Glenda
+if the cell is not empty.
+.PP
+.I findglenda
+returns first cell which has
+.B Glenda
+inside.
+.I checknext
+is a depracated varient of
+.I pointdir.
+.PP
+.I score1 ,
+.I calc
+and
+.I nextglenda
+are... uh..., functions i guess?
+i don't know what they do. they are supposed to be computer's algorithm,
+please let me know if you know what's going on!
+.PP
+.I restart
+reverts grid layout to
+.B ogrid 
+and sets turn to 0.
+.I undo 
+undos to last move done by tapper, sets
+to
+.B turn - 2.
+it's expected to be buggy, and only works once.
+(further calls to
+.I undo
+reverts the map to orignal state before first call of undo.)
+.I checkstate
+checks whetever game has finished or not, and who has won.
--- /dev/null
+++ b/doc/todo
@@ -1,0 +1,90 @@
+infra and documention:
+	- have a mkfile X
+		- cli
+		- documention X
+		- 9 client X
+		- sdl
+		- 9 server
+		- unix server
+	- have a makefile X
+		- documention
+	- write a man page for engine's documention X
+		- make it better!
+			- write info for score1, calc and nextglenda
+		- have one paragraph per each function
+		- add enums and variables
+engine:
+	- move win/lose to engine
+	- make engine.c and engine.h from plan 9 client √
+	- improve portablity √
+		- compiles on plan 9 √
+		- compiles on unix √
+		- compiles on windows, dos?
+	- add turn √
+		- use turn in cli client √
+		- use turn in plan 9 client √
+			- show turn somewhere
+	- domove() check if there are walls there √
+	- move move() to engine √
+		- some client-dependent parts are still in gui9
+	- use dirmove in domove() √
+	- figure what we should do with checknext, should we keep it? it's pretty like domove();
+	- bring turn mangment to engine
+		- undo √
+		- restart √
+		- move √
+		- put √
+	- should we make grid, turn and other stuff private and access them with some wrapper function?
+	- seprate computer player stuff into seprate functions
+	- unix.h √
+		- make sysfatal noreturn √
+
+9 client:
+	- game board often is way smaller than window itself, what gives?
+	- acme/sam colors √ (somewhat)
+		- real ACME™ colors!
+	- undo
+		- ed-style dumb undo √
+		- ed-style smarter? undo
+		- sam-style (∞) undo
+	- multiplayer version √
+		- ok, needs more testing √
+		- even more testing √
+	- net
+	- add flags for multiplayer √
+	- show turn, player somewhere
+
+cli client:
+	- single player 
+	- multiplayer √ (somewhat)
+	- net
+	- zig-zag effect √
+	- fix bugs
+		- SE sometimes goes to east?? √ (it's ok, engine does it)
+		- make map feel hex √ (somewhat)
+			- see if there are any better ways to do so
+	- compile and test? in plan 9 √
+	- compile and test in linux
+	- compile and test in windows(!)
+	- handle (handle what?)
+	- remove m and p, do actions based on turn (NE instead of m NE etc)
+	- undo √
+	- quit √
+
+SDL client:
+	- makefile
+	- compile and test? in plan 9
+	- compile and test in linux
+	- compile and test in windows(!)
+
+network protocol:
+	- define protocol, rfc style?
+	- refrence impl.
+
+plan 9 server:
+	- ???
+
+unix server:
+	- have a barebones version X
+	- pick a port
+	- multithreaded