func (g *Game) buildBoard() giu.Layout {
	if !g.gameEnd {
		if g.players.Current().Type() == ttgplayer.PlayerPC {
			g.board.SetIndexState(
				ttgpcplayer.GetPCMove(g.board, g.players.Current().Letter()),
				g.players.Current().Letter(),
			)
			g.players.Next()
		}
	}

	board := giu.Layout{}
	for y := 0; y < g.board.Height(); y++ {
		line := giu.Layout{}

		for x := 0; x < g.board.Width(); x++ {
			idx := y*g.board.Width() + x
			s := g.board.GetIndexState(idx)
			btn := giu.Button(s.String()+"##BoardIndex"+strconv.Itoa(idx)).
				Size(buttonW, buttonH).OnClick(func() {
				if !g.gameEnd {
					if s == ttgletter.LetterNone && g.players.Current().Type() == ttgplayer.PlayerPerson {
						g.board.SetIndexState(idx, g.players.Current().Letter())
						g.players.Next()
					}
				}
			})

			var c color.RGBA

			switch s {
			case ttgletter.LetterX:
				c = color.RGBA{
					R: 0,
					G: maxByteSize,
					B: 0,
					A: maxByteSize,
				}
			case ttgletter.LetterO:
				c = color.RGBA{
					R: maxByteSize,
					G: 0,
					B: 0,
					A: maxByteSize,
				}
			}

			if g.gameEnd {
				for _, i := range g.winningCombo {
					if i == idx {
						c = color.RGBA{
							R: 0,
							G: 0,
							B: maxByteSize,
							A: maxByteSize,
						}
					}
				}
			}

			styled := giu.Style().SetColor(giu.StyleColorText, c).To(btn)

			line = append(line, styled)
		}

		board = append(board, giu.Row(line...))
	}

	return board
}
// nolint:gocognit // will change later
gocognit // will change later
// nolint : gocognit // will change later
func (g *Game) buildBoard() giu.Layout {
	if !g.gameEnd {
		if g.players.Current().Type() == ttgplayer.PlayerPC {
			g.board.SetIndexState(
				ttgpcplayer.GetPCMove(g.board, g.players.Current().Letter()),
				g.players.Current().Letter(),
			)
			g.players.Next()
		}
	}
	board := giu.Layout{}
	for y := 0; y < g.board.Height(); y++ {
		line := giu.Layout{}
		for x := 0; x < g.board.Width(); x++ {
			idx := y*g.board.Width() + x
			s := g.board.GetIndexState(idx)
			btn := giu.Button(s.String()+"##BoardIndex"+strconv.Itoa(idx)).
				Size(buttonW, buttonH).OnClick(func() {
				if !g.gameEnd {
					if s == ttgletter.LetterNone && g.players.Current().Type() == ttgplayer.PlayerPerson {
						g.board.SetIndexState(idx, g.players.Current().Letter())
						g.players.Next()
					}
				}
			})
			var c color.RGBA
			switch s {
			case ttgletter.LetterX:
				c = color.RGBA{
					R: 0,
					G: maxByteSize,
					B: 0,
					A: maxByteSize,
				}
			case ttgletter.LetterO:
				c = color.RGBA{
					R: maxByteSize,
					G: 0,
					B: 0,
					A: maxByteSize,
				}
			}
			if g.gameEnd {
				for _, i := range g.winningCombo {
					if i == idx {
						c = color.RGBA{
							R: 0,
							G: 0,
							B: maxByteSize,
							A: maxByteSize,
						}
					}
				}
			}
			styled := giu.Style().SetColor(giu.StyleColorText, c).To(btn)
			line = append(line, styled)
		}
		board = append(board, giu.Row(line...))
	}
	return board
}
func ( g * Game ) buildBoard ( ) giu . Layout { if ! g . gameEnd { if g . players . Current ( ) . Type ( ) == ttgplayer . PlayerPC { g . board . SetIndexState ( ttgpcplayer . GetPCMove ( g . board , g . players . Current ( ) . Letter ( ) ) , g . players . Current ( ) . Letter ( ) , ) g . players . Next ( ) } } board := giu . Layout { } for y := 0 ; y < g . board . Height ( ) ; y ++ { line := giu . Layout { } for x := 0 ; x < g . board . Width ( ) ; x ++ { idx := y * g . board . Width ( ) + x s := g . board . GetIndexState ( idx ) btn := giu . Button ( s . String ( ) + " " + strconv . Itoa ( idx ) ) . Size ( buttonW , buttonH ) . OnClick ( func ( ) { if ! g . gameEnd { if s == ttgletter . LetterNone && g . players . Current ( ) . Type ( ) == ttgplayer . PlayerPerson { g . board . SetIndexState ( idx , g . players . Current ( ) . Letter ( ) ) g . players . Next ( ) } } } ) var c color . RGBA switch s { case ttgletter . LetterX : c = color . RGBA { R : 0 , G : maxByteSize , B : 0 , A : maxByteSize , } case ttgletter . LetterO : c = color . RGBA { R : maxByteSize , G : 0 , B : 0 , A : maxByteSize , } } if g . gameEnd { for _ , i := range g . winningCombo { if i == idx { c = color . RGBA { R : 0 , G : 0 , B : maxByteSize , A : maxByteSize , } } } } styled := giu . Style ( ) . SetColor ( giu . StyleColorText , c ) . To ( btn ) line = append ( line , styled ) } board = append ( board , giu . Row ( line ... ) ) } return board }
gocognit // will change later
gocognit // will change later