govariantsteam / govariants Goto Github PK
View Code? Open in Web Editor NEWA place to play Go variants
Home Page: https://www.govariants.com
License: GNU Affero General Public License v3.0
A place to play Go variants
Home Page: https://www.govariants.com
License: GNU Affero General Public License v3.0
The launch command runs tsc
on server
, so we want to make sure it passes. Also it's good to check the types anyway.
Somewhat related - maybe we don't want heroku checking types? I believe transpilers such as babel can convert to JS faster and they won't die because of missing types..
We should have one!
In hidden information games, the clients should not have access to the whole moves list. My thought is that the following endpoints can be created:
/games/%id%/state
/games/%id%/state/%seat%
(partial state)It would return the output of exportState()
.
Not totally necessary, but would be better than raw IDs.
Here's how we had it with React:
Another example is https://online-go.com/observe-games
Probably caused by #70
To reproduce:
Two scenarios where you might want not want the board to register hover and drag events:
Need to use an error Boundary of some sort.
MongoStore seems like the easiest way to do this.
I'm not really sure how this should work, but time settings are a pretty big part of the game.
When I first set up the Heroku stuff, I thought we would need two servers - one to serve the client (React/Vue) and one for the REST server (Express). Turns out we can build the client code and serve it directly from the Express server, so multiple Procfiles are not necessary.
Currently, there is no way using the UI to end the game! Need to fix that!
As demonstrated in commit 01c399f variants can share some parts of code. Abstractions like this reduce code redundancy and should make it easier to add similar variants.
The commit introduced an examplary class AbstractAlternatingBlackWhiteOnGridVariant
, which was used as superclass for the Baduk and TicTacToe variants. Other variants call for more considerations on how to achieve a better form of abstraction:
A couple of high level design thoughts:
- Is this method of creating an intermediate subclass composable?
- Example: HexGo might be described as an AlternatingBlackWhite variant, and Go Battle Royale might be described as a Grid variant. If we had two subclasses
AlternatingBlackWhiteVariant
andAbstractGridVariant
, is it possible to compose the two intoAbstractAlternatingBlackWhiteGridVariant
?- As far as minimizing redudancy between Go and TicTacToe, it's definitely a useful exercise, but I don't think we want to go too deep into
TicTacToe
specifically as it was just a demonstration for how a game can be added.- Looking at the list of games we wanted to focus on in the forum thread, only Pyramid Go fits the
AbstractAlternatingBlackWhiteGridVariant
- Go Battle Royale (grid, cycle/simul?)
- Simultaneous Fractional Multicolour Go 2 (grid, simul)
- Thue-Morse (Fair Sharing) Sequence 2 (grid, 2player, but not alternating)
- Diplomatic Go (simultaneous moves) 3 (grid, simul)
- Pyramid Go 3 (grid, alternating)
Originally posted by @benjaminpjones in #27 (comment)
Also worth mentioning are thoughts on abstraction expressed in the OGS forum.
I removed this as a requirement for the MVP. For now, data is stored in memory and lost when the server restarts.
Still, a DB will be crucial. Some discussion to be had on which one.
Postgres seems like the straightforward choice, but Mongo seems like it might shine here since game data doesn't have a consistent schema.
Currently it's just whatever Create React App put in there. We can change this to Go Variants and whatever logo comes out of #11 .
For some reason, html is being returned and it confuses JSON.stringify(), so the error shown isn't very useful. I think this has something to do with the fact that we are calling next() on error (a fix I had to do to deal with express not knowing how to handle unhandled promise exceptions!)
Screenshot (should say something like "you can't place a stone on an existing stone"):
MVP requirements =
See discussion at: #11
After clicking the Create Game button, a game is created, but the UI doesn't change. We should just open the new game.
We should have default configs for each game, since right now it defaults to a config that works for baduk.
The nav bar seems to change position, depending on what page you're on. We should try to keep it fixed. The easiest way to do this will be to lock it to the top and have it take up the whole width. But with some more css, we could do something fancy like locking it to the bottom or sides.
Like seats at a poker table. You sit down to play and it associates you with a Player number. This depends on users being in place (#5)
games/:game_id/sit/:seat_num
games/:game_id/leave/:seat_num
games/:game_id
: add players field, an array of seats with length game.numPlayers()
SeatComponent
and integration into GameView
Example from VGS:
What I've got on seats branch so far:
I'm not sure how to fix this. Maybe by importing the ts files into client/server directly rather than pointing to the dist dir.
Straightforward task for 19x19, but creativity needed for other sizes. Some nice ideas/code in this thread..
https://forums.online-go.com/t/star-points-on-non-standard-board-sizes/34723
https://en.wikipedia.org/wiki/Rules_of_chess
(might be interesting if this variant still had a ko rule ๐)
Could save a trip :)
And would help mollify #47
Question: should this be implemented at the individual level? I was hoping that games would not need to keep track of history. And it would be relatively simple to implement the (super)ko rule at an abstract level. Something like:
const gamestate = deepCopy(game.exportState());
// Note: Array.prototype.includes won't work since we are comparing JS objects. We'll
// either need to make history a special type of Array or just use a different function.
if (history.includes(gamestate)) {
throw Error("illegal ko");
}
history.push(gamestate);
It shows in the JSON but should be more prominent
It recently came to my attention that server-side errors aren't handled well (try sending a move from the wrong player! fixed that, but there are others). If an async function throws, the server will crash and needs to be manually restarted. A couple things we can do:
I noticed there's about 11 lint errors in the Vue app, but nothing enforcing it. Here's a list of things that we need in order to get the whole repo linted:
"eslint:recommended"
There are also a variety of IDE integrations available for ESLint that folks can use for faster feedback: https://eslint.org/docs/latest/user-guide/integrations
The api allows viewing different pages. It also shows oldest games first. It would be better to:
If the game is over, we should show the result and prevent new moves from being submitted to the server.
Same issue as #20, but getting rid of Vite instead of React ๐
One example of an invalid config:
{
height: 100,
width: 19,
komi: 5.5
}
height is too large for SGF format- game creation should fail!
This is important, but not required for v1
It rememebers you are sitting at the seat, but not which player was selected (you can sit at multiple seats, hence the selection after sitting)
Requires end-to-end support (Resign button in the UI, resignation on the backend)
Some design questions:
If player A and player B are both on the game page, and player A plays a move, player B's board will not update. We can use socket.io to send moves to clients as they are played.
Just throwing in Express sends out a 500 error code, which usually indicates a bug on the server. Many errors are thrown on purpose when the client makes a mistake (game not found, invalid move). We should use the proper error codes for these:
In addition, the UI should surface these errors to the user where appropriate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.