refactoring

This commit is contained in:
Marco 2023-10-27 11:23:13 +02:00
parent 5acc573fc0
commit e09ec0ce0f
5 changed files with 5 additions and 6 deletions

View File

@ -12,7 +12,6 @@ func (b *Board) GetNonBlockedRowAndColumn(fromSquare types.Coordinate) []types.C
nonBlocked = append(nonBlocked, b.getNonBlockedConsecutive(squaresRight, fromSquare)...)
nonBlocked = append(nonBlocked, b.getNonBlockedConsecutive(squaresAbove, fromSquare)...)
nonBlocked = append(nonBlocked, b.getNonBlockedConsecutive(squaresBelow, fromSquare)...)
return nonBlocked
}

View File

@ -63,10 +63,10 @@ func (game *Game) prepare() {
func (game *Game) Handle() {
defer game.killGame()
game.prepare()
game.prepare()
var receivedMove types.Move
var err error
var err error
for {
switch game.gameState {

View File

@ -18,7 +18,7 @@ func Test_Rook_GetNonBlockedSquares(t *testing.T) {
assert.Len(t, squares, 14)
})
t.Run("free row and column", func(t *testing.T) {
t.Run("blocked row and column", func(t *testing.T) {
board := newBoard()
rook := Rook{Color: types.Black}
rookCoordinate := types.Coordinate{Col: 5, Row: 5}

View File

@ -75,7 +75,7 @@ func hostPrivateGame(c *gin.Context) {
u := usher.GetUsher()
mut.Lock()
defer mut.Unlock()
defer mut.Unlock()
lobby := u.CreateNewPrivateLobby(player)
u.AddPlayerToLobbyAndStartGameIfFull(player, lobby)

View File

@ -12,7 +12,7 @@ func NewPassphrase() Passphrase {
var phrase string
var retries int
var word string
var words int = 2
var words = 2
//TODO make sure passphrases are unique
for words > 0 {
retries = 20