<commit_before>module Main exposing (..)

import UltimateTicTacToeWithAI
import UltimateTicTacToe
import TicTacToeBase
import SvgUtils
import Menu
import Task
import Window
import Html.Attributes as HA
import Html
import Html exposing (Html, div, node)
import Svg exposing (svg)
import Svg.Attributes as SA


main =
    Html.program
        { init = init
        , update = update
        , view = view
        , subscriptions = subscriptions
        }



-- MODEL


type alias Model =
    { ticTacToe : UltimateTicTacToe.Model
    , menu : Menu.Model
    , windowSize : Window.Size
    }


init : ( Model, Cmd Msg )
init =
    let
        model =
            { ticTacToe = UltimateTicTacToe.init
            , menu = Menu.init
            , windowSize = { width = 800, height = 600 }
            }
    in
        model ! [ getWindowSize ]



-- UPDATE


type Msg
    = TicTacToeMessage UltimateTicTacToe.Msg
    | NewWindowSize Window.Size
    | SizeUpdateFailure String -- any chance of this failing? look up doc
    | MenuMessage Menu.Msg


update : Msg -> Model -> ( Model, Cmd Msg )
update msg ({ ticTacToe, menu, windowSize } as model) =
    let
        newModel =
            case msg of
                TicTacToeMessage msg ->
                    let
                        update =
                            case menu of
                                Menu.OnePlayerVsAI ->
                                    UltimateTicTacToeWithAI.update

                                Menu.TwoPlayers ->
                                    UltimateTicTacToe.update

                                _ ->
                                    UltimateTicTacToe.update
                    in
                        { model | ticTacToe = (update msg ticTacToe) }

                NewWindowSize size ->
                    { model | windowSize = size }

                MenuMessage msg ->
                    { model | menu = Menu.update msg menu }

                SizeUpdateFailure _ ->
                    model
    in
        newModel ! []


getWindowSize : Cmd Msg
getWindowSize =
    Task.perform SizeUpdateFailure NewWindowSize Window.size



-- SUBSCRIPTIONS


subscriptions : Model -> Sub Msg
subscriptions model =
    Sub.batch [ Window.resizes NewWindowSize ]

<commit_msg>Fix compile error because of Task.perform signature change in 0.18<commit_after>module Main exposing (..)

import UltimateTicTacToeWithAI
import UltimateTicTacToe
import TicTacToeBase
import SvgUtils
import Menu
import Task
import Window
import Html.Attributes as HA
import Html
import Html exposing (Html, div, node)
import Svg exposing (svg)
import Svg.Attributes as SA


main =
    Html.program
        { init = init
        , update = update
        , view = view
        , subscriptions = subscriptions
        }



-- MODEL


type alias Model =
    { ticTacToe : UltimateTicTacToe.Model
    , menu : Menu.Model
    , windowSize : Window.Size
    }


init : ( Model, Cmd Msg )
init =
    let
        model =
            { ticTacToe = UltimateTicTacToe.init
            , menu = Menu.init
            , windowSize = { width = 800, height = 600 }
            }
    in
        model ! [ getWindowSize ]



-- UPDATE


type Msg
    = TicTacToeMessage UltimateTicTacToe.Msg
    | NewWindowSize Window.Size
    | MenuMessage Menu.Msg


update : Msg -> Model -> ( Model, Cmd Msg )
update msg ({ ticTacToe, menu, windowSize } as model) =
    let
        newModel =
            case msg of
                TicTacToeMessage msg ->
                    let
                        update =
                            case menu of
                                Menu.OnePlayerVsAI ->
                                    UltimateTicTacToeWithAI.update

                                Menu.TwoPlayers ->
                                    UltimateTicTacToe.update

                                _ ->
                                    UltimateTicTacToe.update
                    in
                        { model | ticTacToe = (update msg ticTacToe) }

                NewWindowSize size ->
                    { model | windowSize = size }

                MenuMessage msg ->
                    { model | menu = Menu.update msg menu }
    in
        newModel ! []


getWindowSize : Cmd Msg
getWindowSize =
    Task.perform NewWindowSize Window.size



-- SUBSCRIPTIONS


subscriptions : Model -> Sub Msg
subscriptions model =
    Sub.batch [ Window.resizes NewWindowSize ]


{'fraction_non_alphanumeric': 0.06285072951739619, 'fraction_numerical': 0.003367003367003367, 'mean_word_length': 1.3867166577396894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6833792', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1208, 'n_words': 326}