Skip to content

deniscostadsc/playground

Repository files navigation

Playground - A place to play programming.

CI

In this repository, you'll see my solutions for programming/security challenges/contest sites. Here you can find my solutions for:

Project structure

The following tasks are available in the Makefile:

make clean  # remove files created by the run task
make languages  # show numbers of solutions in different languages per folder
make lint [LINTS='language extensions']  # check lint for all solutions if no LINTS is passed
make lint-fix [LINTS='language extensions']  # format all code if no LINTS is passed
make new-problem FOLDER=path/to/create LANGUAGE='language extension'  # create solution template
make run [FOLDER=path/to/run] [LANGUAGES='language extensions']  # run solutions
make wrong  # show all solutions that are not complete yet

Some of these tasks run scripts on the scripts folder and Docker containers from the .docker folder. Needless to say, these tasks require Docker and Docker-compose.

If you are starting your repo to store your solutions for programming competition from the scratch, you can use the same structure I have used. You'll need to copy the following folders and files:

  • .clang-format
  • .docker/
  • .flake8
  • .github
  • .isort.cfg
  • Makefile
  • editor-config
  • scripts/

The scripts/CI assume a few things:

  • You use a folder for each problem;
  • Each problem folder has a problem.md file. CI scripts use this file to search for problems;
  • Problem folders may have an in.txt file. That file holds the input test for that problem. Some problems don't have input;
  • Each problem folder has an out.txt file. That file holds expected output to test (using diff) output generated by your program;
  • All scripts ignore solution whose the folder holds a file name WRONG. You can create this flag file for solutions that aren't completed yet.

Bellow, you can see an example of a problem folder structure:

$ tree solutions/beecrowd/
solutions/beecrowd/
├── 1000
│   ├── 1000.c
│   ├── 1000.clj
│   ├── 1000.cpp
│   ├── 1000.cs
│   ├── 1000.dart
│   ├── 1000.go
│   ├── 1000.hs
│   ├── 1000.java
│   ├── 1000.js
│   ├── 1000.kt
│   ├── 1000.lua
│   ├── 1000.ml
│   ├── 1000.pas
│   ├── 1000.php
│   ├── 1000.py
│   ├── 1000.r
│   ├── 1000.rb
│   ├── 1000.rs
│   ├── 1000.scala
│   ├── imgs
│   │   └── UOJ_1000.png
│   ├── out.txt
│   ├── problem.md
│   └── tags.txt
...