@startuml
title Aubie's Memory Game SSD

actor Player
participant Aubie
participant Database

group SD: Aubie's Memory Game

    Player -> Aubie: Start

    loop while !(gameOver)
        Player <-- Aubie:Board
        note right: UC: show Simon Board


        loop while(index > 0)
            Player <-- Aubie:Create Sequence
            note right: UC: create sequence to light up
            Player <-- Aubie:Flash Sequence
            note right: UC: buttons to be pressed light up
            Player <-- Aubie:index decremented
        end


        loop while (player hits correct button)
            Player -> Aubie:press lights
            note right: UC: press button

            alt player hits wrong button
                Player <-- Aubie: gameOver
            end
        end

        alt !gameOver
            Player <-- Aubie: increment score
            note right: UC: score incrementation based on difficulty
        end

    end

    Player -> Database: Publish Score
    note right: UC: user chooses whether to save score or not
    Player -> Database: View Leadboards
    Player -> Aubie: Restart Game
    Player -> Aubie: Replay Sequence
    Player -> Aubie: Reset Board



end
@enduml