We wanted to create an open learning platform for our class that we were planning on teaching this summer. We've found that many people, including ourselves, when starting out with competitive programming, were overwhelmed with information, and couldn't figure out where to start. Additionally, due to an inability to easily add our own problems to other judges and some inherit flaws in such websites, we decided to create our own.
What it does
PZOJ is an online judge with algorithmic problems that you can submit to in various programming languages. These types problems can typically be seen in competitive programming and interviews as they test your ability to creativity use algorithms and data structures to solve a problem. The status of your submission is displayed in real time as it's being graded using web sockets, allowing you to quickly make adjustments and fix your code on the fly. It also has a learning section for when you are struggling on a concept, which is linked to in our editorials for each problem. This allows anyone to try a problem, and should they get stuck on it easily read the intuition and an optimal solution. If they don't understand that solution because of a lack of previous knowledge, the core concepts are readily available right here on our website, providing an elaborate ecosystem where users can learn concepts then use those concepts immediately on our problems.
How we built it
We used the C language for the judging back-end with the built in Linux kernel functions to monitor sub process resource usage. Our technology stack for the website itself consists of an Express.JS back-end, a Next.JS front-end on top of React whilst using TailwindCSS & SCSS for the styling and various other tools like Axios for calls to the back-end and react-three-fiber for rendering.
Challenges we ran into
Robert: There were some issues that really slowed down the front-end like GUI not scaling properly, having to learn new NPM packages etc etc, but the most annoying part was the integration. A fair chunk of the features that were meant to be implemented got cancelled because for most of the Hackathon the back-end team and the front-end team worked in separate voice calls, resulting in a bit of miscommunication which not only made updating the pages dynamically painful, but sometimes straight up impossible due to how the database was set up.
Hao: There were a lot of issues stemming from Git and Github where our team members were unable to pull certain new changes even though they were previously pushed onto Github. This cost much confusion for our team and led to a lot of wasted time figuring out what each of our code looked like and comparing it against each other. Since we were using VSCode Liveshare in conjunction with Git, we also had to close and re-open the Liveshare frequently.
Kevin: This was my first time using Linux's rlimit/ptrace functionality, and learning how it worked was a huge hassle as well as debugging. Also, throughout the entire Hackathon, my internet kept acting up, reaching 120 seconds of ping at one point.
William: I also had no idea how to supervise and monitor the child process, so there was a ton of trial and error and unexpected behavior. It was also a huge pain to sanitize the code input to put it in JSON when testing (a ridiculous amount of backslashes were needed).
Overall: Some non-code difficulties were indeed encountered as explained by Hao, but something not mentioned was the constant issues with ping on both Liveshare and Discord. A funny experiment we did was playing ping pong (one person would say "ping", and wait for the others to reply with "pong") which led to a rough estimate of about 7000ms of ping consistently even though we all live in the same city.
Accomplishments that we're proud of
Building a finished product in the short time allocated during this Hackathon was a huge accomplishment. In addition to that, the fact that we successfully learned all sorts of new concepts and figure out how to implement them into our project in a short time frame is something we're all proud of as well!
What we learned
- Linux ptrace & sandboxing
- Asynchronous programming
- Tracing program syscalls
What's next for PZOJ
- A contest system + a rating system