Skip to content

1v1 your friends in leetcode, and sabotage them! Made during UQCS' Hackathon 2024

License

Notifications You must be signed in to change notification settings

Antimatter543/CodeClash

Repository files navigation

imageWIP -- Anti is making this look better (5/9/24):

  • Pretty up README, having it ordered and make sense (add some diagrams?)
  • Make a short video about actually going through the project and showcasing a game.
  • Writing a blogpost for it

Will be done by: Who knows :D

Intro

Ever wanted to get better at competitive programming, but found leetcoding by yourself too boring?

Play CodeDuel! Now, you can vs a friend with questions, and sabotage their code!

image

image

AWS Backend Stuff

  • Run the docker for judge0 execution
  • From cd CodeClash, do python3 aws_backend/app.py to run the flask app.
  • To use testscript, change the LOCAL variable depending on if you're using a server or hosting app locally, and then python3 aws_backend/testscript.py from the CodeClash directory.

LeetCode Questions

Scraper

Used modules request and BeautifulSoup to scrape this website:

Solutions (Multi-Language)

Used Open-Source solutions to save Python and Java solutions on the server.

Figuring out Test Cases

This was difficult because test cases are not open source, and every tech company is holding off their resources. This issue can be summarised by the Owner of LeetCode from a while back. image

So, we used an open-source LeetCode test case generator, where each question has its own generate_test_case function.

How to generate test cases: https://github.com/darshansharma/leetcode-testcase-generator

For the sake of saving performance on our server and for simplicity sake, we generated one set of test cases for every question, and tested the code on every perfect leetcode answer. The output is saved in a txt file, each test cases seperated by a new line.

Language Support (Python and Java)

Basically, Docker is on the AWS server, it hosts Judge0 which will compile, run and output results of any given code and our local machines can interpret the output from the run code. Judge0 requires a string in the requested coding language, and must contain a way to output to stdout. Because we have test cases, we input the expected answers into stdin and each language will have to read through each line to test the test cases. image image

Judge0 will return a .json format output which looks like this: image And will be interpreted by each user's machine.

About

1v1 your friends in leetcode, and sabotage them! Made during UQCS' Hackathon 2024

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •