This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2023-11-27 MIT LICENSE | |
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com. | |
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town. | |
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same! | |
Send me your ChatGPT text adventure game on X, I'd love to try it! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const data = require('./track.json') | |
let duration = data.track.duration | |
let segments = data.segments.map(segment => { | |
return { | |
start: segment.start / duration, | |
duration: segment.duration / duration, | |
loudness: 1 - (Math.min(Math.max(segment.loudness_max, -35), 0) / -35) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* buildHtml - Helper method to construct html tags easily */ | |
var buildHtml = function(tag, attrs, innerHtml) { | |
var h = '<' + tag; | |
for (var attr in attrs) { | |
if(attrs[attr] === false) { | |
continue; | |
} | |
h += ' ' + attr + '="' + attrs[attr] + '"'; | |
} | |
return h += innerHtml ? '>' + innerHtml + '</' + tag + '>' : '/>'; |