A simple TicTacToe app with Golang backend and WebSockets gluing it all together.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
559 B

  1. package main
  2. import (
  3. uuid "github.com/satori/go.uuid"
  4. )
  5. // Game object for binding with JSON POST body
  6. type Game struct {
  7. UUID uuid.UUID `json:"id" binding:"required"`
  8. Players []*Player `json:"players"`
  9. Turn *uuid.UUID `json:"turn"`
  10. Draw *bool `json:"draw,omitempty"`
  11. Winner *uuid.UUID `json:"winner,omitempty"`
  12. Matrix [9]*uuid.UUID `json:"matrix" binding:"min=9,max=9"`
  13. }
  14. // Player object for binding with JSON POST body
  15. type Player struct {
  16. UUID *uuid.UUID `json:"id"`
  17. Name string `json:"name,omitempty"`
  18. }