My first reaction was that this must have been some kind of plot to make young people interested in COBOL using the type of games the current demographic of this language knows best.
Neat! The actual COBOL is pretty minimal, just tracking where the balls and paddles are and then calling out to update the DOM. It doesn't look anywhere near as horrific as I would have expected :)
My take is that people who fear COBOL probably haven't seen pre-ES5[0] JavaScript.
[0] While ES2015 was a major leap in and of itself, it wouldn't have happened had ES5 not laid the groundwork by introducing "minor improvements" that we now take for granted like JSON, strict mode and Function.prototype.bind to name a few.
The existing mapping is ridiculous. A,D,J,L are all in a horizontal line, but are mapped to vertical motions.
There are many choices, but for example, using A/Z for left player up/down and J/M for right player up down would not require any mental work. Once you place your fingers, up is up and down is down.
This is sweet! Interestingly it seems to only accept QWERTY input even when the keyboard has an alternate mapping set. This makes sense though given the positions of the keys chosen
The ball doesn't seem to bounce "properly" - i.e. upwards if it lands towards the top of the paddle and downwards if it lands towards the bottom of the paddle.
35 comments
[ 1.5 ms ] story [ 111 ms ] threadhttps://github.com/moxon6/cobol-js-emscripten/blob/master/co...
[0] While ES2015 was a major leap in and of itself, it wouldn't have happened had ES5 not laid the groundwork by introducing "minor improvements" that we now take for granted like JSON, strict mode and Function.prototype.bind to name a few.
There are many choices, but for example, using A/Z for left player up/down and J/M for right player up down would not require any mental work. Once you place your fingers, up is up and down is down.
What's the deal with the alternator function (in app.js)? Why should keypresses be read only on every other attempt?
Also, is there some kind of implicit sleep or requestAnimationFrame somewhere? Or is it busy-looping and polling for key presses as fast as it can?
This is just a hack around that to simulate entering a value and then pressing escape on the next prompt request
https://moxon6.github.io/cobol-js-emscripten/cobol-js/index....
where is the cobol?
https://github.com/moxon6/cobol-js-emscripten/blob/master/co...
I am still looking around so may be wrong.
`index.wasm` is built using the build scripts in the source repo
`main.cob` contains the main logic used to generate `index.wasm`
https://github.com/moxon6/cobol-js-emscripten/blob/master/co...
How did you remove all the bloat generated after Emscripten's compilation?
I've coded a snake game in C and when I compiled, the app.js file itself was ~2mb.