Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize command line interaction #122

Merged
merged 114 commits into from
Sep 20, 2023

Conversation

ImogenBits
Copy link
Collaborator

This is a rather hefty PR that probably should've been split up but 🤷🏻‍♀️
The main idea of this is to update the command line interface to not be based on argparse and curses, but on typer and rich. This gives the tool a look and UX actually fitting of it being developed in 2023 :3
It also let us easily add the utility features we brought up a while ago, namely being able to do a quick test of student programs, and making the Docker learning curve not as steep. This is done by adding a bunch of subcommands:

  • algobattle run: this is the old algobattle, does the same thing with slightly different arguments and a much, much nicer UI
  • algobattle config: opens the global config file
  • algobattle test: runs a quick test of the programs, building both, and running basically a single fight to make sure they at least perform correct IO operations
  • algobattle init: This is where the real magic happens. It takes the file specifying a problem that students download from the algobattle website and initializes the student's project directory. This lets us easily manage problem specific dependencies since we can just install them here, lets us bundle the various python and config, and documentation files for each problem together in a user friendly way, and most importantly takes the burden of the students first having to learn how Docker works of their shoulders. Students can now just download the .algo file from the website, run algobattle init --problem path/to/download.algo --generator python --solver rust and everything will be set up for them, including basic generator/solver projects with a Dockerfile that they'll only need to modify if they want to create more advanced programs.
  • algobattle package: The reverse of the init command, takes various problem files and packages them into a .algo problem spec. Students will never need to run this, and course instructors very rarely if ever since the web server will take care of this step automatically. It's just included here for completeness's sake and in case you want to use algobattle on its own.

There's still a lot of functionality to be added to these commands, but even in their current form they should make it a lot easier for students to get into things and a much, much better UX overall. In particular, while I've tried to add support for every reasonably popular language, some of the templates are very rudimentary. Python, Rust, Javascript, and Typescript all have fully featured templates that setup a project skeleton suitable for algobattle programs. But Java, C, C++, C#, and Go only contain rudimentary hello world scripts. I'm just not familiar enough with these languages to setup a basic json parsing and file io program and include an actual dependency manager in the Dockerfile.

I've also updated and reworked the docs to reflect these changes and also just be more cohesive and easy to understand in general. They also look marginally nicer with some new mkdocs features.

Finally, some screenshots of the new UI just to show it off :3
Running a match with a single team:
image

Testing programs:
image

Building programs during a match:
image
A match with multiple battles being run at once:
image

@Benezivas
Copy link
Collaborator

These are some very impressive changes, thank you very much. I will merge this PR early and vote for more extensive testing before the final release, as we need to demo the code for the upcoming semester soon.

@Benezivas Benezivas merged commit baf89ba into Algorithmic-Battle:4.0.0-rc Sep 20, 2023
2 checks passed
@ImogenBits ImogenBits deleted the util_scripts branch September 20, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants