module IdeaFight.Compete exposing (Model, Msg, init, update, subscriptions, view)

import IdeaFight.Shuffle as Shuffle

import Html.App as App
import Html exposing (Html, text)

import Random
import String

type alias Model = List String
type Msg = ShuffledContents (List String)

init : String -> (Model, Cmd Msg)
init contents =
  let lines = String.lines contents
  in ([], Random.generate ShuffledContents <| Shuffle.shuffle lines)

update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
  case msg of
    ShuffledContents contents -> (contents, Cmd.none)

subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none

view : Model -> Html Msg
view model = text <| toString model

main : Program Never
main = App.program {
    init = init "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight",
    update = update,
    subscriptions = subscriptions,
    view = view
  }

module IdeaFight.Compete exposing (Model, Msg, init, update, subscriptions, view)

import IdeaFight.Shuffle as Shuffle

import Html.App as App
import Html exposing (Html, text)

import Random
import String

type alias Model = (List String, Int)
type Msg = ShuffledContents (List String)

init : String -> (Model, Cmd Msg)
init contents =
  let lines = String.lines contents
  in (([], 3), Random.generate ShuffledContents <| Shuffle.shuffle lines)

update : Msg -> Model -> (Model, Cmd Msg)
update msg (_, numTop) =
  case msg of
    ShuffledContents contents -> ((contents, numTop), Cmd.none)

subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none

view : Model -> Html Msg
view model = text <| toString model

main : Program Never
main = App.program {
    init = init "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight",
    update = update,
    subscriptions = subscriptions,
    view = view
  }

Introduce numTop model member for compete subapp
Introduce numTop model member for compete subapp

This is hardcoded as 3 for now, but it will be the number of
best ideas to result from the application
