aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/paulo-custodio/check_challenge_title.pl
blob: 02a8d1babd6b2392ea634d36a8e628ca6114e6ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env perl

# show stats of challenge submissions

use Modern::Perl;
use Path::Tiny;

my $USER = "paulo-custodio";

our %LANG = (
    ada     => 'adb',
    awk     => 'awk',
    basic   => 'bas',
    bc      => 'bc',
    brainfuck=>'pl', #'bf',
    c       => 'c',
    cpp     => 'cpp',
    d       => 'd',
    forth   => 'fs',
    fortran => 'f90',
    lua     => 'lua',
    pascal  => 'pas',
    perl    => 'pl',
    python  => 'py',
);

for my $chall_dir (path(".")->children(qr/challenge-\d+/)) {
    my($chall) = $chall_dir =~ /(\d+)/ or die;
    $chall += 0;

    for my $lang (sort keys %LANG) {
        my $dir = path($chall_dir, $USER, $lang);
        next unless $dir->is_dir;

        for my $sol ($dir->children(qr/^ch[-_]\d\.$LANG{$lang}$/)) {
            my $text = $sol->slurp;
            if ($text !~ /Challenge 0*$chall\b/) {
                say $sol;
            }
        }
    }
}