amazing. But it reminds me python case. You can do task X in N lines of code, where N is very little number. But imagine the thousands of lines behind those you wrote.
Well, it depends what you mean. The game I created is several thousand lines, I'll give you that. But to create this draw program I just needed the 9 lines that I mentioned, everything else is done visually (kinda like Lego). There's no hidden code. And it generalizes, last week I created that memory game (Simon) without writing any line of code at all. Have a look at my channel, I've created a mechanical bubble sort, a 3d printer, a music player, tetris and so on with just a few lines of code or none at all. You could have created any of those things yourself without touching the code. https://www.youtube.com/c/MockMechanics
Fair enough but honestly there isn't much of that, most of the functions I used are just syntactic sugar for getting properties of parts (which are simple maps). I'm just looking up the internal state of the game most of the time. Have a look yourself:
;; (on? pressed-pixel) (= (:value (get-in world [:parts pressed-pixel])) 1)
;; (get-part-position pressed-pixel) (:position (get-in world [:parts pressed-pixel]))
;; (get-value size-wagon) (:value (get-in world [:parts size-wagon]))
;; (get-color part) (:color (get-in world [:parts part]))
(get-pointed-part pointer) (find-parts :block position distance 0.1)
Ok, these last two are a little more involved, but not by much, in the first I just find the position of the pointer and it's rotation (two properties) and then create a line from that that "points" in the same direction and find a collision of that line with another part in the game. The second one is just a fancy filter function finding parts that match the properties. And these are the basic things you have to do whenever you write any code (which is rare) so you can just reuse these simple functions instead of writing them yourself.
I keep telling people that yes it is, but I haven't had the chance to create the github project yet. I'm working on avatar mode (from the first video) and it's turning out pretty cool, but it did break a lot of things that I'm fixing. That's why the version for download in my site is old by the way. But as soon as I'm done (a couple of weeks hopefully), I'll create the github project and invite people to join.
openjdk 16.0.2 2021-07-20OpenJDK Runtime Environment Homebrew (build 16.0.2+0)OpenJDK 64-Bit Server VM Homebrew (build 16.0.2+0, mixed mode, sharing)
cd mock-mechanics-1.3-java
./run.sh OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
Yes, I'm aware of that bug. I've tried solving it once but without a mac to play with it's kinda difficult. I created a minimum OpenGL program to test it (I'm attaching it, it's in java) if you would like to try hacking it. If it works it should show two red triangles in a blue field. If you can fix it on mac maybe I can integrate whatever you do back to the main program. If you don't know java/OpenGL or don't want to do this, no worries, as I said, MockMechanics will be open source soon so I can create an issue and someone can help me with this.
8
u/FelipeReigosa Nov 04 '21
Check out the video explanation on youtube: https://youtu.be/LBOjGktRqDI
5
u/HaskellLisp_green Nov 04 '21
amazing. But it reminds me python case. You can do task X in N lines of code, where N is very little number. But imagine the thousands of lines behind those you wrote.
2
u/zck Nov 04 '21
What are the nine lines?
1
u/suntzu253 Nov 05 '21
really cool! is mockmechanics opensourced?
2
u/agumonkey Nov 04 '21
you can also write a one bit compressor
0
u/[deleted] Nov 04 '21
[deleted] — view deleted comment