Closed a-temlyakov closed 9 years ago
OK, this makes sense.
We should also make the output a more clear.
For example the only way to know if AI decided to stop is to look at the logs.
And for a while I though the game was broken! It's just I didn't know how to run it, and I only figured it out by looking at the code.
I guess some directions would be helpful.
I think I can do this one.
Yeah, I think that's all front-end work once the JSON work is complete. JSON data should carry all relevant information and then once we parse it with JS we can decide how to handle it... e.g. when AI stops the AI button becomes inactive (there are probably better ways to handle AI turns other than spamming a button, too :). Also need a place to display all relevant turn information about score, dices rolled, etc.
This is done, right?
Yes, I think so.
Currently the result of turns (and other data) is passed to client as a very roughly created string: https://github.com/Akavall/GoGamesProject/blob/master/basic_server.go#L204
It would be much better to standardize it and pass back the data as a JSON format.
Go has (or seems to) have really good support for JSON: https://gobyexample.com/json and we can easily parse it with JavaScript on client side.
We probably need to create new structs specifically for this...