DEV Community


Posted on


HTML + JS + Python = hard

So I’m going to make a game in Python where you hear chords/notes and you have to figure out what note it is.

I’ve already written the script for creating the note sounds, and I’ll probably save all the notes to a audio file each.

For the rules, I’ll give one minute to the user to do as many notes as they can do.

But the game will be rendered via HTML, and I’ll be saving best scores and stats in Python, so how will I connect them together?

I was thinking of doing the counting in JavaScript, choosing the random note in JavaScript, and save the score for the round in JavaScript via cookies. Then when the game ended, I could redirect to a url with the score so I could do the function in that url.
But that isn’t the best solution as that way anyone can go to the url and change their score, or they can use the console to change the cookie data anyways.
Is there a more secure way of doing this?

Top comments (4)

vulcanwm profile image

Thanks! I’ll try this out!

dillonb07 profile image
Dillon Barnes

Not sure if it will be useful for you here, but you can check out PyScript which is a way of writing Python insider your HTML.

Thread Thread
vulcanwm profile image

I’ll try that out! Thanks

Visualizing Promises and Async/Await 🤓

async await

☝️ Check out this all-time classic DEV post on visualizing Promises and Async/Await 🤓