Noughts & Crosses

Noughts and Crosses

This is a noughts and crosses bot using various algorithms.

sa: score adding without optimizations sa+rd: score adding with ratio optimization including draw (score between win and loose) sa+r-d: score adding with ratio optimization not including draw (draw = loss) mm: minimax mm+d: minimax with depth

Board

{status}

{#if loaded} { board[event.detail.idx] = human; completeTurn(); }} /> {:else}

Loading...

{/if}

Scores

View scores for each potential move here. Cells are numbered from 1 to 9 going left-to-right, top-to-bottom. The table headers show the cell numbers.

{#if showPreviousScores || showCurrentScores} { return { key: c.toString(), value: (c + 1).toString() }; }) ]} rows={[ ...(showPreviousScores ? scores.slice(0, -1).map(scoreToRows(showScoresFor)) : [] ), ...(showCurrentScores && scores.length !== 0 ? [scoreToRows(showScoresFor, "Now")(scores.slice(-1)[0], scores.length)] : [] ) ]} /> {/if}