π
π π
π€ Markov Chain Example π€βοΈπ’
# Define states and transition probabilities
π π weatherTransitions
π‘"Sunny" β‘οΈ π
π‘"Sunny" β‘οΈ 0.7
π‘"Rainy" β‘οΈ 0.3 π
π‘"Rainy" β‘οΈ π
π‘"Sunny" β‘οΈ 0.5
π‘"Rainy" β‘οΈ 0.5 π π
# Function to get next state based on current state
π π‘ getNextState π‘ currentState
π π randomValue π₯½ 1.0 # Generate a random float between 0 and 1
π
π π¬ randomValue < weatherTransitionsπcurrentStateππ‘"Sunny"βοΈ π
β©οΈ π‘"Sunny"
π π
β©οΈ π‘"Rainy" π π π
# Simulate the Markov chain
π β‘οΈ simulateMarkovChain π‘ initialState π‘ steps
π currentState π₯Ί initialState
π π πi π‘ stepsβοΈβοΈ π
currentState π€Stepπ€ πi π€:π€ π‘ currentStateβοΈπ’
currentState π‘ getNextState πcurrentStateβοΈ π π
# Initial state and number of steps to simulate
π‘ initialState π‘ "Sunny"
π‘ steps π₯Ί 10
# Run the simulation
π‘ simulateMarkovChain πinitialState π‘ stepsβοΈ
π
[2]https://github.com/hfg-gmuend/openmoji
[3]https://github.com/twitter/twemoji
[4]https://github.com/googlefonts/noto-emoji
[5]https://github.com/microsoft/fluentui-emoji
[6]https://github.com/sensadesign/sensaemoji