Giter VIP home page Giter VIP logo

manwar / perlweeklychallenge-club Goto Github PK

View Code? Open in Web Editor NEW
172.0 172.0 308.0 121.82 MB

Knowledge base for The Weekly Challenge club members using Perl, Raku, Ada, APL, Awk, Bash, BASIC, Bc, Befunge-93, Bourne Shell, BQN, Brainfuck, C3, C, CESIL, C++, C#, Clojure, COBOL, Coconut, Crystal, D, Dart, Dc, Elm, Emacs Lisp, Erlang, Excel VBA, Fennel, Fish, Forth, Fortran, Gembase, GNAT, Go, Haskell, Haxe, HTML, Idris, IO, J, Janet, Java, JavaScript, Julia, Kotlin, Lisp, Lua, M4, Miranda, Modula 3, MMIX, Mumps, Myrddin, Nim, Nix, Node.js, Nuweb, OCaml, Odin, Ook, Pascal, PHP, Python, Postscript, Prolog, R, Ring, Ruby, Rust, Scala, Scheme, Sed, Smalltalk, SQL, Swift, Tcl, TypeScript, Visual BASIC, WebAssembly, Wolfram, XSLT and Zig.

Home Page: https://theweeklychallenge.org

perlweeklychallenge-club's Introduction

The Weekly Challenge Club

This is the central repository for the members of The Weekly Challenge. The members can submit the solution to the challenge each week in their favorite programming languages, although the preferred languages are Perl and Raku.

EZPWC - Easy Perl Weekly Challenges Script

Saif Ahmed, respected member of Team PWC, created the tool EZPWC to help you with contributing to the weekly challenge. We highly recommend you give it a try. If you have any questions/suggestions, then please raise an issue against the tool.

How to contribute?

Just submit a Pull Request with your solutions.

First, find the latest challenge folder. The highest numbered folder is the latest challenge folder, e.g. challenge-002. You will probably find a folder by your name if you are an existing member. For example, if your name is "Joe Blog", there would be a folder called "joe-blog". Under your named folder, you will find a file README. Depending on your choice of language, you should create a folder here e.g. perl for Perl and raku for Raku. Inside each of these folders, you can save your solutions. If it is a Perl script for Task #1, call it ch-1.pl. Similarly, if it is a Perl script for Task #2, call it ch-2.pl. For Raku solutions, call it ch-1.raku and ch-2.raku respectively. And if you are writing a one-liner, call it ch-1.sh or ch-2.sh. If you are contributing for the first time, please create your named folder as described above. Also, let us know what name you would like us to use.

If you have created a blog about your solutions, then create a file called blog.txt and add the link. If you have more than one blog, create another file called blog1.txt and add your link there.

Step-by-step instructions

Let us assume you want to submit solutions for Challenge 002, and your GitHub user name is joe-blog.

  1. If you are submitting the solution for the first time, then you have to Fork the repository https://github.com/manwar/perlweeklychallenge-club by clicking the "Fork" button in the top right corner and should have the repository, e.g. https://github.com/joe-blog/perlweeklychallenge-club.

  2. Go to your favorite terminal and clone your repository.

    $ git clone https://github.com/joe-blog/perlweeklychallenge-club
    
  3. Create a new branch for the solution

    $ cd perlweeklychallenge-club
    $ git checkout -b new-branch
    
  4. Go to the Challenge 002 folder.

    $ cd challenge-002
    
  5. If you find a folder with your name in the current folder, you can just go ahead and skip to the next step; otherwise, create a new folder.

    $ mkdir joe-blog
    
  6. Change into your named folder.

    $ cd joe-blog
    
  7. If you just created the folder, you should add a file README and add a line Solution by Joe Blog otherwise, skip to the next step.

  8. If you want to submit Perl 5 solutions, you should create a folder perl (if you still need to). Similarly, if you want to submit Raku solutions, then you should create a folder raku (if not already).

  9. Change into your relevant folder depending on your choice cd perl or cd raku.

  10. Now you are ready to add your solutions. If it is for the first challenge, create a file named ch-1.pl or ch-1.raku or ch-1.sh. Similarly, if it is for the second challenge, create a file named ch-2.pl or ch-2.raku or ch-2.sh.

  11. Once you are happy with your solutions, add them to the repository. First, go back to root of the repository and then fire the command

    $ git add challenge-002/joe-blog
    
  12. Commit your changes.

    $ git commit
    
  13. Push your changes.

    $ git push -u origin new-branch
    
  14. Now go to your fork repository in the GitHub web portal https://github.com/joe-blog/perlweeklychallenge-club

  15. You should see a button to submit Pull Request.

How to add a new solution when you already have the forked repository?

Let us assume you already have the repository forked. If this is the first time you use the same forked repository for submitting subsequent challenges solution. I also assume your GitHub user name is joe-blog.

  1. Checkout out the master branch first.

    $ git checkout master
    
  2. Check if you have set up upstream.

    $ git remote -v
    

    You should see something similar:

    origin  https://github.com/joe-blog/perlweeklychallenge-club (fetch)
    origin  https://github.com/joe-blog/perlweeklychallenge-club (push)
    upstream        https://github.com/manwar/perlweeklychallenge-club (fetch)
    upstream        https://github.com/manwar/perlweeklychallenge-club (push)
    

    If you don't see upstream as above, then you need to set up your upstream like below:

    $ git remote add upstream https://github.com/manwar/perlweeklychallenge-club
    

    Check if you have everything set up correctly.

    $ git remote -v
    

    If you see a similar output as above, you have set up upstream correctly. Just so you know, you only need to do it once.

  3. Now we need to fetch latest changes from the upstream.

    $ git fetch upstream
    
  4. We will merge the changes into your local master branch.

    $ git merge upstream/master --ff-only
    
  5. Push your master changes back to the repository.

    $ git push -u origin master
    
  6. Now it is time to create a new branch for a new challenge

    $ git checkout -b branch-for-challenge-005
    
  7. Once you have a new branch ready, you can add your solutions or blog information.

    $ cd challenge-005/joe-blog
    
    $ echo "URL to the blog" > blog.txt
    
    $ mkdir perl
    
    $ cd perl
    
    Add script like ch-1.pl or ch-2.pl or ch-1.sh or ch-2.sh
    
    $ mkdir raku
    
    $ cd raku
    
    Add script like ch-1.raku or ch-2.raku or ch-1.sh or ch-2.sh
    

    Test your script now.

  8. Commit your changes.

    $ git add challenge-005/joe-blog
    
    $ git commit
    
  9. Now push the newly created branch branch-for-challenge-005

    $ git push -u origin branch-for-challenge-005
    
  10. Time to submit your changes as Pull Request.

    Go to the GitHub web profile

    https://github.com/joe-blog/perlweeklychallenge-club

    You should see a button to create Pull Request.

Dave Cross wrote a very detailed blog post covering the minimum knowledge of git and GitHub needed to start contributing. Highly Recommended.

If you have any trouble with the above instructions then please get in touch with me anytime [email protected].

perlweeklychallenge-club's People

Contributors

0rir avatar adamcrussell avatar andemark avatar arnesom avatar boblied avatar choroba avatar dcw803 avatar drbaggy avatar drclaw1394 avatar e7-87-83 avatar firedrake avatar fluca1978 avatar holli-holzer avatar jacoby avatar jaldhar avatar jeongoon avatar jmaslak avatar jo-37 avatar luboskolouch avatar manwar avatar mattneleigh avatar ownoizri avatar pauloscustodio avatar perlmonk-athanasius avatar polettix avatar simongreen-net avatar stuart-little avatar tylerw avatar waltman avatar wlmb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perlweeklychallenge-club's Issues

M4 vs Macro Processor

I've submitted seven M4 solutions in total, but only three of them are classified as M4 solutions -- the other four are classified as "Macro Processor".

While M4 is a macro processor, not all macro processors are M4. And being consistent would be better anyway.

Befunge -> Befunge-93

It would be better to classify my Befunge-93 solutions as Befunge-93, not just Befunge. The differences between Befunge-93 and (Be)funge-98 are substantial, aka C vs C++ and Perl5 vs Perl6^WRaku.

git operations take a lot of time

Currently there are over 70,000+ files in this repository and every week we're adding 100s of files (every week a directory is created for every user and the previous "README" is copied).

I started participating with challenge-076. According to my records I've submitted solutions for 25 challenges, so there are ~100 useless directories with my name and a README file. With around 300 users, I believe this adds up.

My primary machine is not very fast and it takes 70 seconds to run git status.

andinus@ ~//perlweeklychallenge-club > time git status                
On branch master                                                                              
Your branch is up to date with 'origin/master'.                                               
                                                                                              
                                                                                              
It took 54.97 seconds to enumerate untracked files. 'status -uno'                             
may speed it up, but you have to be careful not to forget to add                              
new files yourself (see 'git help status').                                                   
nothing to commit, working tree clean                                                         
                                                                                              
________________________________________________________                                      
Executed in   71.65 secs                                       
                                                                                              
andinus@ ~//perlweeklychallenge-club > time git status -uno                 
On branch master                                                                              
Your branch is up to date with 'origin/master'.                                               
                                                                                              
nothing to commit (use -u to show untracked files)
                                                                                              
________________________________________________________                                      
Executed in   16.89 secs

Uphill Task

Greetings to all teammates.

Do you want to have an extra-challenging task each month?
Or, do you accept coding extra lines in order to solve an interesting task once a month?

Do you know an algorithm from your computer science study, would like to share with TWC teammates, but thought it might be relatively heavy?
Or, do you like to share a practical technique or procedure applied in some widely-used Perl frameworks? Why don't propose the idea as a TWC task?

Or, has an intriguing question just popped in your mind? You simply want to share it.

It is Week 135 of the TWC Calendar and 287 tasks have been appeared. Different algorithms commonly-learnt by computer science students or programmers have been used in the vast amount of solutions. Sometimes some advanced algorithms or data structures were being used. Regular participating teammates may have an expectation of the demand(difficulty, lines needed, number of test cases) of the tasks and arrange a time-slot in their planner to solve the tasks. And some techniques have been used again for the third time and you might want to code more stuff in that week.

Secretly(?), I am a distance runner. Uphill training is a demanding but beneficial workout in distance running. Since it is so demanding, most leisure runners do not put this workout in their usual schedule, or take the workout less frequent than other types of workout. However nobody declines the benefits of uphill training brings. And usually you will have a great sense of satisfaction when it's done!

So, why don't accept AN EXTRA WORKLOAD coding challenge task regularly?


I suggest having an "Uphill Task 2" in the 2nd week of each month.

It can be fun:

  • create an engine to solve a traditional board game;
  • code about something that professional mathematicians in number theory haven't solved. (I just come up with one such kind of coding puzzles, but not to share here in order to keep with the discussion.)

It can be practical:

  • interact with a database;
  • apply support for a famous framework in Perl;
  • design a mini-app according to the requirements;
  • something like API tasks on Week 008 to Week 024 but more sophisticated.

It can be pedagogical:

  • craft a simplified interpreter;
  • simulate a Turing machine;
  • introduce an advanced data structure or algorithm.

What do you think about "having an 'uphill task' in The Weekly Challenge once a month"?
Would you think that it is better to make the "uphill task" as a "Task 3"?? (But a bit increase in administrative workload.)
Do you have any related suggestions? :)

P.S. For an example of what an "uphill task" might look like, N Queens of Week 062 (Week 062 , RECAP) should be a candidate. Or you get other candidates. (I still like the Adventure of Knight, which I proposed, hahaha.)

-- from CY

Challenge solutions not compliant

One of the PWC members submitted a solution in Bash to challenge 104 like this:
echo "0 1 1 2 1 3 2 3 1 4 3 5 2 5 3 4 1 5 4 7 3 8 5 7 2 7 "
"5 8 3 7 4 5 1 6 5 9 4 11 7 10 3 11 8 13 5 12 7 9 2 9"

This is not generating the sequence of the 50 first FUCS numbers as requested.

Should this be accepted as a valid solution? What if someone writes a program in Perl to output code in N languages to just print the result of the Perl computation?

how to submit perl one liner?

Hello,
if I have a perl oneliner as solution, how to submiti it? I would not to submit it as bash..

Better as a .pl file with the oneliner as first commented line?

Actually I have 2:
206 t1
208 t2

thanks

L*

This program finds a sequence of only 14 words with Mohammad's input list

This program apparently finds a best sequence of only 14 words with Mohammad's input list, and this is (IMHO) wrong. As far as I can say, the longest sequence has at least 23 words, and there are more than two thousand such sequences.

Note: If this Github issue goes to Mohammad, then, @mohammad: please transmit to Simon, I don't have an email address to communicate directly with Simon. @mohammad: please feel free to give my e-mail address to Simon to enable direct mail exchange.

Best regards to both of you,
Laurent.

Suggestion - Data Structure and algorithm in Perl/Raku

While going through github I found some github repository which talk about data structure and algorithm in different languages (mostly python).
A quick google search on data structre and algo for github given me lot of link with implementation in different languages (again mostly python)

Few of them are (top rated)-
https://github.com/TheAlgorithms
https://github.com/keon/algorithms

In 'TheAlgorithm' repo i found they have implementation in almost every language except Perl.
So, I just thought of why we don't have any such repo (Pardon my ignorance if we have).
I know some of us will this this is trivial, but for a new commer(who just freshly graduated) such things are boon. If we want to attract new people in community we should have data structure and algorithm in Perl/Raku.

So, just a suggestion , is it possible to have this thing as weekly challenge ? (say implementation 'sorting/tree' etc. in Perl/Raku) and have a separated repo for all DS implementation in Perl/Raku ?
I think both Perl and Raku will benefit from this (especially Raku).

benchmark scaleability of solutions

I am interested in learning from solutions to Raku/Perl weekly challenge that are readable and efficient - the second point I can not judge easily by just running the provided minimal testcases.

I was wondering if there is interest out there in automatically comparing different solutions in terms of scalability - meaning, what problem size can be solved in a fixed runtime.

First thoughts and a first shot #8644 and a github-action how an automated process might look like (look into "Run Benchmark" and scroll down a bit).

It looks like this:

O-----------------O---------O--------O-------------O-------------O
| user            | runtime | n      | latency     | total       |
O=================O=========O========O=============O=============O
| two-colours     | 3       | 524288 | 0.94618477  | 1.78539195  |
| mark-anderson   | 3       | 524288 | 0.934987441 | 1.797814585 |
| arne-sommer     | 3       | 524288 | 0.951995122 | 2.034696379 |
| bruce-gray      | 3       | 524288 | 0.966044871 | 2.068688515 |
| Orir            | 3       | 524288 | 1.171071109 | 2.081696549 |
| roger-bell-west | 3       | 524288 | 2.077494412 | 2.574138279 |
| rcmlz           | 3       | 262144 | 0.47831577  | 1.52560537  |
| wambash         | 3       | 262144 | 0.481722904 | 1.922695617 |
| jaldhar-h-vyas  | 3       | 262144 | 2.462856115 | 2.865514525 |
| deadmarshal     | 3       | 65536  | 2.532371318 | 2.635808188 |
| ash             | 3       | 65536  | 2.621710334 | 2.691216938 |
| barroff         | 3       | 32768  | 1.853222122 | 1.883633262 |
| massa           | 3       | 32768  | 2.576829156 | 2.624975424 |
| ulrich-rieke    | 3       | 4096   | 1.51628605  | 1.519228254 |
------------------------------------------------------------------

After checkout try this:

zef install JSON::Tiny Text::Table::Simple
NR=233
raku --optimize=3 -I challenge-nr$NR -- test/benchmark-scalability.raku --max-run-times=3 --test-before-benchmark=True -v --max-problem=20 --out-folder=/tmp nr$NR

I put in the github-action also a small Tokei analysis, looking like below. Maybe this is usefull for some of us to find interesting solutions of other people.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Language                                                               Files        Lines         Code     Comments       Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Raku                                                                      37          737          540           80          117
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 challenge-nr233/packy-anderson/raku/task-one.rakumod                                   57           36           12            9
 challenge-nr233/ulrich-rieke/raku/task-one.rakumod                                     40           34            2            4
 challenge-nr233/athanasius/raku/task-one.rakumod                                       43           29            2           12
 challenge-nr233/ulrich-rieke/raku/task-two.rakumod                                     29           23            2            4
 challenge-nr233/packy-anderson/raku/task-two.rakumod                                   34           23            6            5
 challenge-nr233/roger-bell-west/raku/task-one.rakumod                                  26           23            1            2
 challenge-nr233/roger-bell-west/raku/task-two.rakumod                                  25           22            1            2
 challenge-nr233/arne-sommer/raku/task-one.rakumod                                      29           22            2            5
 challenge-nr233/rcmlz/raku/task-one.rakumod                                            26           20            2            4
 challenge-nr233/rcmlz/raku/task-two.rakumod                                            27           20            2            5
 challenge-nr233/robert-dicicco/raku/task-one.rakumod                                   23           18            2            3
 challenge-nr233/laurent-rosenfeld/raku/task-two.rakumod                                21           16            2            3
 challenge-nr233/wambash/raku/task-one.rakumod                                          20           15            2            3
 challenge-nr233/luca-ferrari/raku/task-two.rakumod                                     17           13            1            3
 challenge-nr233/barroff/raku/task-two.rakumod                                          17           13            2            2
 challenge-nr233/ash/raku/task-one.rakumod                                              17           13            1            3
 challenge-nr233/ash/raku/task-two.rakumod                                              17           13            1            3
 challenge-nr233/Orir/raku/task-two.rakumod                                             16           12            2            2
 challenge-nr233/Orir/raku/task-one.rakumod                                             17           12            3            2
 challenge-nr233/luca-ferrari/raku/task-one.rakumod                                     16           12            1            3
 challenge-nr233/athanasius/raku/task-two.rakumod                                       16           12            1            3
 challenge-nr233/laurent-rosenfeld/raku/task-one.rakumod                                16           12            2            2
 challenge-nr233/barroff/raku/task-one.rakumod                                          18           12            2            4
 challenge-nr233/jaldhar-h-vyas/raku/task-two.rakumod                                   16           11            2            3
 challenge-nr233/deadmarshal/raku/task-one.rakumod                                      14           10            2            2
 challenge-nr233/wambash/raku/task-two.rakumod                                          14           10            2            2
 challenge-nr233/bruce-gray/raku/task-one.rakumod                                       15           10            3            2
 challenge-nr233/deadmarshal/raku/task-two.rakumod                                      13            9            2            2
 challenge-nr233/arne-sommer/raku/task-two.rakumod                                      12            8            2            2
 challenge-nr233/massa/raku/task-two.rakumod                                            11            8            1            2
 challenge-nr233/jaldhar-h-vyas/raku/task-one.rakumod                                   11            7            2            2
 challenge-nr233/mark-anderson/raku/task-two.rakumod                                    10            7            1            2
 challenge-nr233/mark-anderson/raku/task-one.rakumod                                    10            7            1            2
 challenge-nr233/two-colours/raku/task-one.rakumod                                      12            7            3            2
 challenge-nr233/two-colours/raku/task-two.rakumod                                      11            7            2            2
 challenge-nr233/massa/raku/task-one.rakumod                                            10            7            1            2
 challenge-nr233/bruce-gray/raku/task-two.rakumod                                       11            7            2            2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.