SkillAgentSearch skills...

MarkovChains

Markov Chains on top of GKStateMachine

Install / Use

/learn @NSFWObject/MarkovChains
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Complimentary code for the blogpost http://blog.zats.io/2015/08/29/markov-chains-with-gameplaykit/

Basically

let m = MarkovChainMachine(initialStates: [a, b], mapping: [
    [a, b]: [
        [0.3: a],
        [0.7: b]
    ],
    [b, a]: [
        [0.7: a],
        [0.3: b]
    ],
    [a, a]: [
        [0.1: a],
        [0.9: b]
    ],
    [b, b]: [
        [0.9: a],
        [0.1: b]
    ]
])

for _ in 0...15 {
    if m.enterNextState() {
        print(m.currentState!, separator: "", terminator: " ")
    }
}

Prints A B B A B B A A B A A B A A B B A A

🐶🐮

View on GitHub
GitHub Stars7
CategoryDevelopment
Updated7mo ago
Forks1

Languages

Swift

Security Score

62/100

Audited on Aug 25, 2025

No findings