You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+7-10
Original file line number
Diff line number
Diff line change
@@ -65,10 +65,12 @@ Each player takes a turn, selecting an empty square to place their piece in.
65
65
66
66
IF a player gets X in a row (where X == the number of squares needed to win), then they win, and everyone else loses !
67
67
68
+
If a player wins, then all the base are belong to them.
69
+
68
70
## Zero Wing Enabled
69
71
70
72
Each turn, a player may randomly get Zero Wing Enabled. In this mode, the border of the board is printed in orange, and they can click on ANY square
71
-
(including both empty squares AND squares that has another players piece already), and it is changed to their piece.
73
+
including both empty squares AND squares that has another players piece already ... and the square is changed to their piece.
72
74
73
75
## Set us up the Bomb
74
76
@@ -85,12 +87,7 @@ seems to zap 1 other adjacent square. Maybe. Cant reproduce it yet.
85
87
I will either fix this bug, or leave it in there as a feature - rationale is that there might be some bomb residue laying around
86
88
after someone set us up the bomb.
87
89
88
-
## Bug 2
89
-
90
-
There is another bug somewhere, where closing a browser that it connected to an event stream, then re-opening another one, will
91
-
deadlock the event thread in the server. I think this is whats happening, but not sure. Needs some time to play with it / prove it / fix it.
92
-
93
-
Only happens every now and then, cant reproduce it yet. Other than that, the thread locking seems pretty robust so far.
90
+
Havent seen it happen lately, but then I havent changed anything to fix it either .... so who knows ?
94
91
95
92
## More Modes and Gameplay ideas
96
93
@@ -109,18 +106,18 @@ Thinking up some new random modes to add to make the game harder - ideas most we
109
106
110
107
This code is interesting for the following reasons :
111
108
112
-
- Its all written in Zig
109
+
- Its all written in Zig. Fast / Safe / Easy to read - pick all 3.
113
110
- It uses the excellent http.zig library https://github.com/karlseguin/http.zig
114
111
- Generated docker image = 770Kb (compressed) All it has is the compiled executable (2.5MB), which includes all bundled assets in the single file binary
115
112
- Run stats - uses about 60MB RAM and really low CPU %
116
113
- Its about as simple as doing the same thing in Go, there is really nothing too nasty required in the code.
117
114
- The router, and all the HTML contents is part of the Game object ... the implications of this are that it is possible to create 'web components' using this
118
115
zig/htmx approach that are all self contained, and can be imported into other projects, without having to know about connecting up routes, or pulling in content. Interesting.
119
-
- Uses SSE / Event Streams to keep it all realtime updates with pub/sub from multiple players. Is simple, and it works.
116
+
- Uses SSE / Event Streams to keep it all realtime with pub/sub updates for multiple players. Is simple, and it works, and requires not much code at all.
120
117
- Demonstrates how to do threading, thread conditions / signalling, and using mutexes to make object updates thread safe.
121
118
- No websockets needed
122
119
- There is pretty much NO JAVASCRIPT on the frontend. It uses HTMX https://htmx.org ... which is an alternative approach to web clients, where the frontend is pure hypertext, and everything is done on the backend
123
-
- There is a tiny bit of JS, to update the session ID, but im still thinking up a way of getting rid of that as well.
120
+
- There is a tiny bit of JS, to play some audio, and to update the session ID, but im still thinking up a way of getting rid of that as well.
124
121
- Uses std.fmt.print() as the templating engine. I didnt know before, but you can use named tags inside the comptime format string, and use those to reference fields in the args param.
125
122
Actually makes for a half decent templating tool, without having to find and import a templating lib.
0 commit comments