func (c *Canvas) swap() {
	endTS := c.tileSelection(c.selection.end)
	if endTS == nil {
		c.log.Info("swap cancelled")
		return
	}
	if err := c.board.RemoveTile(endTS.tile); err != nil {
		c.log.Error("removing tile while swapping: " + err.Error())
	}
	tiles := []tile.Tile{
		endTS.tile,
	}
	m := message.Message{
		Type: message.SwapGameTile,
		Game: &game.Info{
			Board: board.New(tiles, nil),
		},
	}
	c.Socket.Send(m)
	c.selection.tiles = make(map[tile.ID]tileSelection)
}
// swap trades a tile for some new ones.
swap trades a tile for some new ones.
// swap trades a tile for some new ones .
func (c *Canvas) swap() {
	endTS := c.tileSelection(c.selection.end)
	if endTS == nil {
		c.log.Info("swap cancelled")
		return
	}
	if err := c.board.RemoveTile(endTS.tile); err != nil {
		c.log.Error("removing tile while swapping: " + err.Error())
	}
	tiles := []tile.Tile{
		endTS.tile,
	}
	m := message.Message{
		Type: message.SwapGameTile,
		Game: &game.Info{
			Board: board.New(tiles, nil),
		},
	}
	c.Socket.Send(m)
	c.selection.tiles = make(map[tile.ID]tileSelection)
}
func ( c * Canvas ) swap ( ) { endTS := c . tileSelection ( c . selection . end ) if endTS == nil { c . log . Info ( " " ) return } if err := c . board . RemoveTile ( endTS . tile ) ; err != nil { c . log . Error ( " " + err . Error ( ) ) } tiles := [ ] tile . Tile { endTS . tile , } m := message . Message { Type : message . SwapGameTile , Game : & game . Info { Board : board . New ( tiles , nil ) , } , } c . Socket . Send ( m ) c . selection . tiles = make ( map [ tile . ID ] tileSelection ) }
swap trades a tile for some new ones.
swap trades a tile for some new ones .