For the past 10 days, I and the rest of Purdue Hackers have run Commit Overflow, a challenge in which participants commit once a day and post it in our Discord server. It went pretty well for the community, but this isn't the Purdue Hackers blog. I used it as an excuse to call some of my personal projects work, and I got a lot done (averaging ~5 commits a day if that means anything), so I wanted to write out what I've been up to the last 10 days.

I'll list the progress by project, but generally I alternated between them.

Ornament

One concern I had when we thought of commit overflow is that people would avoid posting their commits if there was an ongoing discussion about another project so as not to derail it. I wanted to incentivize people discussion commits in their own Discord thread, so I made a simple bot to create a thread on each message in a specified channel. It ended up growing to also keep track of an individual's commits and their timezone as well though.

I wrote it in Elixir using Nostrum, which is my favorite Discord bot library. To store data, I just used an ETS table persisted to a Fly.io volume. This turned out to be the biggest headache, because it seems that the Fly volume wasn't available for the first few seconds of the deploy, so the bot defaulted to an empty table. It was pretty easy to fix by adding a retry timer, once I'd figured out the issue.

SIMple Gravity

Recently, I've been in closer communication with Dr. Rebello about using SIMP in Purdue's PHYS 172 online section. However, there's quite a bit of work to make it as seamless as possible by the time students use it, and I also have to write more documentation and labs. Over the past 10 days, I've pushed 15 commits to this project, and there's a lot of progress.

  • Updated egui and macroquad versions (using egui-macroquad 👀)
  • Added a way to toggle engine-driven collisions through the scripting system -- 01
  • Added a rhai script implementing elastic collisions -- 02
  • Added a reset_physics() function to rhai -- 03
  • Improved script editor UI -- 04
  • Improved rhai vector DX -- 05
  • Added an engine integration toggle to the scripting system -- 06
  • Made it possible to access pre-created bodies through the scripting engine -- 07
  • Fixed copy-pasting in browser mode with a JS hack -- 08
  • Made the code editor output scrollable -- 09
  • Fixed some bugs along the way

I also PR'd miniquad to fix an annoying crash on CTRL-V but I didn't really come up with it myself -- 10

It's cool to see how many of these changes are small independently but it's much easier to envision it being used in a class now.

Statistically Correct Python

import sys

if __name__ == '__main__':
  match sys.argv:
    case [_file, _input]:
      raise TypeError("(probably)")
    case [file, _]:
      print(f"Usage: {file} ")

This project mostly speaks for itself. I thought "Modernized Python" in SIGBOVIK was really funny and I was also making fun of Codon a bit.

Symbolic/Concolic Evaluation Notes

I read three papers on concolic execution and wrote some notes.

There's still one more paper to read which I'll probably get to tomorrow. I'm pretty happy with how these turned out, although the DART post is iffy because I already covered most of it in the CUTE one. Writing it all out definitely helped me understand it more, and maybe I'll reference these later. I'll do at least one of these a week from now on.

Cloth Simulation

I wrote a cloth simulation that runs on the web. I wanted to figure out how to do it myself, so my initial version attempts to use a constraint system operating on forces. As it turns out, this leads to really stretchy/flimsy constraints because of computational integration stuff that I don't have a superb understanding of.

Eventually, I basically copied Pezzza's approach, but from what I remember from my research into physics engines in high school, there's nothing too unique about his implementation. My plan was to rewrite it such that the behavior was identical but with a slightly different semantic organization such that I could pretend to be adding forces from constraints, but I got bored and remembered that computational physics /= physics.

I'm overall happy with how it turned out though; I haven't found any bigger/smoother sims that run in the web so I guess I've got the best easily accessible cloth sim on the internet for now. I still need to find the motivation to write a readme though.

OCaml Canvas Pong

I finished this one a day before Commit Overflow started, but I'll count it anyway. I wanted to write something in OCaml and try js_of_ocaml more, so I thought pong would be a good start. My initial plan was to also use esy but I ended up hating it.

You can find the actual game here. I added quite a some fun features like two AI, an accelerating ball, and a speed tracker, but I also left out some fundamental ones like a scoreboard.

Overall, I'm really happy with how js_of_ocaml works. It's nice that I can leave the JS stuff dynamically typed. The actual game logic code is kind of strange because I wanted it to be a simple functional pipeline thing but I'm not sure how to feel about how it turned out. I think it would be helped by either going fully functional with monadic state or going more imperative with mutation, but I'm not sure. I tried out lenses but I think the level of nesting wasn't deep enough to help that much, but it's still deep enough that it didn't hurt.

I can't find any of my WASM pong repos so this is the one on pong.mikail-khan.com now.


New Years

It's been a lot of fun working on stuff that isn't work but I'm pretty tired so I guess I'll take a break. In high school and quarantine I kept this pace for months so hopefully I'll be able to work my way back to that level again.