BrisGolang is a Go implementation of the game of briscola using the WebSocket protocol for client/server communication.

BrisGolang

BrisGolang is a Go implementation of the game of briscola using the WebSocket protocol for client/server communication.

Usage

You can play in 2 ways:

  1. not using the server
  2. using the server

Not using the server

Start the game with go run .

$ go run .

------------- brisGolang -------------

game:       
  players:  
    MAX:   [
    
     
     
      ] 0
    MIN:   [
       
        
        
         ] 0 table: [] trump: ------------- round 1 ------------- game: players: MAX: [5♥ 6♥ 6♠] 0 MIN: [K♣ 4♣ T♥] 0 table: [] trump: ♥ > cardIdx (0,1,2) [default=0]: 
        
       
      
     
    
   

At the prompt type the index of the card (0, 1, 2) you want to play

Using the server

Launch the server

$ go run server/server.go 
http server started on localhost:8080

In another terminal use wscat (or something similar) to open a connection

$ wscat -c ws://localhost:8080/ws
Connected (press CTRL+C to quit)
> 

Type newGame to create a new game

> newGame
< 
game:       
  players:  
    MAX:   [
    
     
     
      ] 0
    MIN:   [
       
        
        
         ] 0 table: [] trump: > 
        
       
      
     
    
   

Type start to start the game

> start
< 
------------- round 1 -------------
< 
game:       
  players:  
    MAX:   [7♠ K♠ J♦] 0
    MIN:   [6♥ T♦ Q♥] 0
  table:   []
  trump:   ♣
> 

Type play and the index of a card (0, 1, 2) to play

> play 1
< 
game:       
  players:  
    MAX:   [7♠ 
   
     J♦] 0
    MIN:   [6♥ T♦ Q♥] 0
  table:   [{MAX K♠}]
  trump:   ♣
< 
game:       
  players:  
    MAX:   [7♠ 
    
      J♦] 0
    MIN:   [6♥ T♦ 
     
      ] 0
  table:   [{MAX K♠} {MIN Q♥}]
  trump:   ♣
< 
------------- round 2 -------------
< 
game:       
  players:  
    MAX:   [7♠ 2♥ J♦] 7
    MIN:   [6♥ T♦ A♣] 0
  table:   []
  trump:   ♣
> 

     
    
   

TODO

  • a multiplayer version
  • a real client
Owner
Calogero Miraglia
I use this corner to share prototypes and tools I build for fun.
Calogero Miraglia
Similar Resources

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.

websocketd websocketd is a small command-line tool that will wrap an existing command-line interface program, and allow it to be accessed via a WebSoc

Dec 31, 2022

Just a PubSub Websocket Server

Eventual Agent Just a PubSub Websocket Server The eventual agent allows cluster local apps to subscribe and publish over network. Goals Provide a WebS

Dec 24, 2022

HLive is a server-side WebSocket based dynamic template-less view layer for Go.

HLive is a server-side WebSocket based dynamic template-less view layer for Go.

HLive HLive is a server-side WebSocket based dynamic template-less view layer for Go. HLive is a fantastic tool for creating complex and dynamic brows

Jan 8, 2023

Websocket server, implemented flow Room style

ignite A websocket server module. Require redis to scale to multi nodes. Client/server message follow format type Message struct { Event string

Apr 10, 2022

Websocket server. Get data from provider API, clean data and send to websoket, when it's changed.

Описание Сервис получает данные по киберспортивным матчам CS:GO от провайдера, структурирует, очищает от лишнего и отправляет всем активным вебсокет к

Apr 6, 2022

A simple server to convert ATK-IMU901 serial data into websocket stream

A simple server to convert ATK-IMU901 serial data into WebSocket stream.

Jan 31, 2022

proxy your traffic through CDN using websocket

go-cdn2proxy proxy your traffic through CDN using websocket what does it do example server client thanks what does it do you can use this as a library

Dec 7, 2022

Simple example for using Turbos Streams in Go with the Gorilla WebSocket toolkit.

Go Example for TurboStreams over WebSockets Simple example for using Turbos Streams in Go with the Gorilla WebSocket toolkit.

Dec 22, 2022

Tiny WebSocket library for Go.

RFC6455 WebSocket implementation in Go.

Dec 28, 2022
Encrypted-websocket-chat - Encrypted websocket chat using golang

Encrypted websocket chat First version written in python This version should be

Sep 15, 2022
Websocket-chat - A simple websocket chat application
Websocket-chat - A simple websocket chat application

WebSocket Chat App This is a simple chat app based on websockets. It allows user

Jan 25, 2022
Client Implementation of eosio state-history websocket.

Client Implementation of eosio state-history websocket.

Dec 6, 2022
Chat bots (& more) for Zoom by figuring out their websocket protocol
Chat bots (& more) for Zoom by figuring out their websocket protocol

zoomer - Bot library for Zoom meetings Good bot support is part of what makes Discord so nice to use. Unfortunately, the official Zoom API is basicall

Dec 14, 2022
🚀 BiliBili Live WebSocket Protocol SDK in Golang
🚀 BiliBili Live WebSocket Protocol SDK in Golang

BiliGO-LIVE BiliBili Live WebSocket Protocol SDK in Golang 简介 v0版本不保证对外函数、结构的不变性,请勿大规模用于生产环境 哔哩哔哩直播 WebSocket 协议的 Golang 封装 特性 良好的设计,自定义程度高 代码、结构体注释完善

Oct 30, 2022
API that upgrades connection to use websocket. Contains server and client and testing how they communicate

Websocket Test API How to execute First run server using: make run-server. Then run many client instances with: make run-client. Then start typing in

Dec 25, 2021
A fast, well-tested and widely used WebSocket implementation for Go.

Gorilla WebSocket Gorilla WebSocket is a Go implementation of the WebSocket protocol. Documentation API Reference Chat example Command example Client

Jan 2, 2023
WebSocket Command Line Client written in Go

ws-cli WebSocket Command Line Client written in Go Installation go get github.com/kseo/ws-cli Usage $ ws-cli -url ws://echo.websocket.org connected (

Nov 12, 2021
A tiny command line websocket client written in Go

wsc A simplistic tool for sending and receiving websocket messages from a command line. Mainly useful to test websocket servers. Getting started: $ go

Jan 12, 2022
Websocket client sample integration (go) for FairOS.

fairos-websocket-client FairOS websocket clients should be an extension on the FairOS OpenAPI specification, with introduction of events for seamless

Jul 14, 2022