Share your repls and programming experiences

← Back to all posts
Shakespeare Wrote Plays, And He's Dead. [Simple Markov chain implementation]
DrankArizonaIce (130)

Struggling to put together a proper screenplay that would determine the fate of graduation for our hero with only hours before the deadline, he spends his time on an ambitious plan to make a script that would generate a semi-plausible excuse of work for his final project.

WILL OUR HERO PREVAIL?? FIND OUT NEXT TIME ON THE NEXT EPISODE OF DRAGON BALL Z!

Yes, it worked.
Yes, I passed.
Yes, I was surprised.

1) Reads some text
2) takes every word and creates weighted average of every other word that comes directly after it
3) do some /fancy/ math
4) Takes a word
5) Random number, falls between the sum of the weights of that word to get a word that comes directly after it
6) repeat step 4 with the product of step 5 a couple thousand times
7) ???
8) Pop! out comes some random looking text that seems like it should make sense but is totally meaningless

I'm no teacher. I'm just as surprised it even works.

I know it works because it does what I'd expect it to do but I'm not qualified enough to describe exactly what it does.

Simply implements a markov chain for words I guess lmao

Commentshotnewtop
TobyS (15)

"i’ve kept my life. occasionally teenager, honestly. i’ve ever since that his parent's robvietnam nudist damage"