7 ms·
WebAssembly COBOL Pong
- ianbooker 6y agoI love how this is a total geekery for fun project and one of the best quasi job application in 2020.
- tiborsaas 6y agoThat's really cool Ian, now can we get back to this directed graph?
- jacoblambda 6y agoThis hurts me on an emotional, spiritual, and physical level.
- Tade0 6y agoMy 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.
- jgrahamc 6y agoSee also, using COBOL with Cloudflare Workers (via WebAssembly): https://blog.cloudflare.com/cloudflare-workers-now-support-cobol/ https://blog.cloudflare.com/cloudflare-workers-now-support-c...
- DarthGhandi 6y agoThat was an enjoyable read, thanks.
- esimov 6y agoCute little project. Thumb up for selecting Cobol as the language of choice for the implementation. I might feel nostalgic.
- deleted 6y ago[deleted]
- angrygoat 6y agoNeat! 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 :) https://github.com/moxon6/cobol-js-emscripten/blob/master/cob/main.cob https://github.com/moxon6/cobol-js-emscripten/blob/master/co...
- Tade0 6y agoMy 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.
- sandov 6y agoRight paddle controls are backwards compared to vim.
- madballster 6y agoA hidden swipe at evil/vim fans by an emacs author?
- saagarjha 6y agoNo, it's clearly just more sane. Without any knowledge of keyboard escape sequences, why should down come before up?
- tasty_freeze 6y agoThe 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.
- hardmaru 6y agoI heard COBOL skills are in demand these days in the US.
- tgv 6y agoAnd now you know why: to reboot Half Life in the browser, leveraging a well-known, time-tested programming language with wide and deep support.
- TurboHaskal 6y agoFor player 2, 'J' goes up, while pressing 'L' goes to the left from the perspective of the paddle. This feels like made in purpose to hurt vi users.
- ptx 6y agoCool! 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?
- moxon6 6y agoThe emscripten JS will keep "prompt"ing for new input until it receives a null (due to the user pressing escape on the dialog) This is just a hack around that to simulate entering a value and then pressing escape on the next prompt request
- elpg454 6y agoWhen I view the source code, it's just a javascript file, https://moxon6.github.io/cobol-js-emscripten/cobol-js/index.js https://moxon6.github.io/cobol-js-emscripten/cobol-js/index.... where is the cobol?
- brainless 6y agoYou mean this file? https://github.com/moxon6/cobol-js-emscripten/blob/master/cob/main.cob https://github.com/moxon6/cobol-js-emscripten/blob/master/co... I am still looking around so may be wrong.
- elpg454 6y agoI was looking to see how it is included on the actual website, do you reference a web assembly file from javascript ?
- moxon6 6y agoThat's the JS generated by emscripten for linking in the WASM, which is `index.wasm` `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/cob/main.cob https://github.com/moxon6/cobol-js-emscripten/blob/master/co...
- benatkin 6y agohttps://youtu.be/st6-DgWeuos https://youtu.be/st6-DgWeuos
- amelius 6y agoNext step: both users playing over the network?
- snowoutside 6y agoThis 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
- gpm 6y agoThe 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.
- ngcc_hk 6y agoIt seems very hard :-) Not the COBOL.
- kibebr 6y agoThat's impressive! 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.
- azakai 6y agoTry Emscripten's new MINIMAL_RUNTIME option. You can often get js files of just a few Kb.
- rdiddly 6y agoI do enjoy a good stunt, although it's also fun to play while I wait for my bloated-ass executable to upload!
- imadfy 6y agoCan you get mobile browsers to open the keyboard? I can't play. :(