This commit is contained in:
44 files changed
+101
-106
No files matched your search
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2025, Lixen Wraith
|
||||
Copyright (c) 2026, Lixen Wraith
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h1>♚♛♜♝♞</h1>
|
||||
<p>
|
||||
<h1 align="center">♚♛♜♝♞</h1>
|
||||
<p align="center">
|
||||
<a href="https://golang.org"><img src="https://img.shields.io/badge/Go-1.27-00ADD8?style=flat&logo=go" alt="Go 1.27"></a>
|
||||
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/License-BSD_3--Clause-blue.svg" alt="License BSD-3"></a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Chess
|
||||
|
||||
@@ -169,8 +163,9 @@ The chess server includes an embedded web UI for playing games through a browser
|
||||
```
|
||||
|
||||
### Features
|
||||
- Visual chess board with drag-and-drop moves
|
||||
- Human vs Computer gameplay
|
||||
|
||||
- Visual chess board with click-to-move and a promotion picker
|
||||
- Human vs Computer gameplay, with undo, draw offers and resignation
|
||||
- Configurable engine strength (0-20)
|
||||
- UCI move history with move numbers
|
||||
- FEN display and custom starting positions
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
)
|
||||
|
||||
func handleExit() (restart bool) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
)
|
||||
|
||||
func handleExit() (restart bool) {
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"chess/internal/client/api"
|
||||
"chess/internal/client/command"
|
||||
"chess/internal/client/display"
|
||||
"chess/internal/client/session"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/command"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/session"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/replay"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/replay"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lixenwraith/auth"
|
||||
|
||||
@@ -14,12 +14,12 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"chess/cmd/chess-server/cli"
|
||||
"chess/internal/server/http"
|
||||
"chess/internal/server/processor"
|
||||
"chess/internal/server/service"
|
||||
"chess/internal/server/storage"
|
||||
"chess/internal/server/webserver"
|
||||
"github.com/lixenwraith/chess/cmd/chess-server/cli"
|
||||
"github.com/lixenwraith/chess/internal/server/http"
|
||||
"github.com/lixenwraith/chess/internal/server/processor"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/webserver"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module chess
|
||||
module github.com/lixenwraith/chess
|
||||
|
||||
go 1.27.1
|
||||
|
||||
@@ -7,7 +7,7 @@ require (
|
||||
github.com/gofiber/fiber/v2 v2.52.15
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jackc/pgx/v5 v5.11.0
|
||||
github.com/lixenwraith/auth v0.0.0-20260927004242-3b8d4a2946f1
|
||||
github.com/lixenwraith/auth v0.5.1
|
||||
golang.org/x/term v0.46.0
|
||||
)
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLM
|
||||
github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
|
||||
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
|
||||
github.com/lixenwraith/auth v0.0.0-20260927004242-3b8d4a2946f1 h1:pXqSd6vdTuTh4lYdSmsoCpAJohZYAatZguE835Ru4NU=
|
||||
github.com/lixenwraith/auth v0.0.0-20260927004242-3b8d4a2946f1/go.mod h1:411JUqnbQgy9jgoFV+fH91TfVUEfzYA4dyPv7f4c264=
|
||||
github.com/lixenwraith/auth v0.5.1 h1:5/eKRyEO4af/vpSLsUgAXaFiECNbCKtQ0EEXnO/oPF4=
|
||||
github.com/lixenwraith/auth v0.5.1/go.mod h1:411JUqnbQgy9jgoFV+fH91TfVUEfzYA4dyPv7f4c264=
|
||||
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
|
||||
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
)
|
||||
|
||||
const HttpTimeout = 30 * time.Second
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"chess/internal/client/api"
|
||||
"chess/internal/client/display"
|
||||
"chess/internal/client/session"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/session"
|
||||
)
|
||||
|
||||
func (r *Registry) registerAuthCommands() {
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chess/internal/client/api"
|
||||
"chess/internal/client/display"
|
||||
"chess/internal/client/session"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/session"
|
||||
)
|
||||
|
||||
func (r *Registry) registerDebugCommands() {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"chess/internal/client/api"
|
||||
"chess/internal/client/display"
|
||||
"chess/internal/client/session"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/session"
|
||||
)
|
||||
|
||||
func (r *Registry) registerGameCommands() {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
)
|
||||
|
||||
func readPassword(prompt string) (string, error) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"chess/internal/client/api"
|
||||
"chess/internal/client/display"
|
||||
"chess/internal/client/session"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/display"
|
||||
"github.com/lixenwraith/chess/internal/client/session"
|
||||
)
|
||||
|
||||
// Command defines a client command with its handler
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"chess/internal/client/api"
|
||||
"github.com/lixenwraith/chess/internal/client/api"
|
||||
)
|
||||
|
||||
// Session maintains client state and configuration
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
)
|
||||
|
||||
type Snapshot struct {
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/processor"
|
||||
"chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/processor"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/service"
|
||||
"chess/internal/server/storage"
|
||||
"chess/internal/server/storage/pgtest"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/storage/pgtest"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/google/uuid"
|
||||
|
||||
@@ -3,8 +3,8 @@ package http
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/lixenwraith/auth"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package processor
|
||||
|
||||
import (
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
)
|
||||
|
||||
// CommandType defines the type of command being executed
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/engine"
|
||||
"chess/internal/server/game"
|
||||
"chess/internal/server/service"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/engine"
|
||||
"github.com/lixenwraith/chess/internal/server/game"
|
||||
"github.com/lixenwraith/chess/internal/server/service"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/engine"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/engine"
|
||||
)
|
||||
|
||||
// EngineTask contains computer move calculation request and response channel
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
)
|
||||
|
||||
func TestEngineQueueShutdownCancelsAndWaitsForCallback(t *testing.T) {
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/game"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/game"
|
||||
)
|
||||
|
||||
func TestRulesCheck(t *testing.T) {
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
)
|
||||
|
||||
// stored returns the stored form of a line played from start.
|
||||
|
||||
@@ -3,9 +3,9 @@ package replay
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
)
|
||||
|
||||
// Verify checks a stored game against the rules and returns one line per
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/game"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/game"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/game"
|
||||
"chess/internal/server/storage"
|
||||
"chess/internal/server/storage/pgtest"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/game"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/storage/pgtest"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/replay"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/replay"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/replay"
|
||||
"github.com/lixenwraith/chess/internal/server/replay"
|
||||
|
||||
"github.com/lixenwraith/auth"
|
||||
)
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/chess"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/chess"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lixenwraith/auth"
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"chess/internal/server/game"
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/game"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/lixenwraith/auth"
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lixenwraith/auth"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/storage"
|
||||
"github.com/lixenwraith/chess/internal/server/storage"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lixenwraith/auth"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/core"
|
||||
"github.com/lixenwraith/chess/internal/server/core"
|
||||
)
|
||||
|
||||
func TestWaitRegistryDeliversNotificationToCallerAndRemovesWaiter(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"chess/internal/server/storage/pgtest"
|
||||
"github.com/lixenwraith/chess/internal/server/storage/pgtest"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
|
||||
Reference in new issue
Block a user