The Weekly Challenge - 101

Monday, Feb 22, 2021| Tags: Perl, Raku

TABLE OF CONTENTS


01. HEADLINES

02. SPONSOR

03. RECAP

04. PERL REVIEW

05. RAKU REVIEW

06. CHART

07. NEW MEMBERS

08. GUESTS

09. TASK #1: Pack a Spiral

10. TASK #2: Origin-containing Triangle


HEADLINES



The Week #100 came and gone. Lets continue the journey together and learn something new from each other.

This week Mark J. Reed and Pablo Saavedra joined the Team PWC. We welcome both of them and wish an enjoyable ride with us.

After nearly 5 months break, I started taking part in the weekly challenge. I hope to continue without break. This week I could only contribute in Perl but very soon I will start contributing in Raku followed by my favourite guest language Swift.

This week, I also create YouTube video after a long time. Although I wanted to do live coding but I could only do just one Thank You video. I hope you like the video.


I am happy with the support that we had in the Week #100 The plan was to beat the previous best figure of 155 contributions but unfortunately we couldn’t get there any where near. To be precise, the final figure for the Week #100 is 120 contributions. So I would like to take this opportunity to thank each and every member for making it such a memorable week.


Contributions Summary

This week, we received 61 contributions from guests in 21 languages. We were so close to beat the previous best figure of 65 contributions in the Week #089.

I would like to THANK each and every guest contributors.


Languages Summary


While we are talking about contributions, let’s share some interesting stats from the GitHub repository.

1. Commits: 14,570 (+320)

2. Pull Requests: 3,597 (+77)

3. Contributors: 159 (+1)

4. Fork: 199

5. Stars: 90


Last but not least, I would like to thank each and every member for their support and encouragement.



Our solo sponsor Pete Sergeant has been a great support to keep us motivated. We are lucky that he agreed to continue the journey with us in the year 2021. I would like to personally thank Pete and his entire team for their generosity. It would be great if we could add few more to sponsor the prize money so that we could go back and declare weekly champions as we have done in the past. I hope and wish this will become possible in 2021. The amount doesn’t have to be huge. However, it would be nice to show off bunch of supporters. If an organisation comes forward and supports us then that would be the ultimate achievement.


RECAP


Quick recap of the “The Weekly Challenge - 100” by Mohammad S Anwar.


PERL REVIEW


If you missed any past reviews then please check out the collection.


RAKU REVIEW


If you missed any past reviews then please check out the collection.


CHART


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


NEW MEMBERS


Mark J. Reed

My preferred language is Raku, which I’ve been using since Pugs was released, but I’m happy to contribute solutions in pretty much anything; if it’s a programming language, I’ve probably used it. So if there are some obscure languages you’d like me to cycle through contributing solutions in, let me know! I’m also a big fan of Ruby, which I’ve been using since before Rails was a thing, and of course Perl, which I’ve been using since version 4, though I originally put off learning it despite my peers’ enthusiastic recommendations because I felt I could already do everything it did using ksh. I think that dates me sufficiently. My day job is as a cloud infrastructure architect for the part of WarnerMedia formerly known as Turner, in Atlanta, Georgia, USA. Most of what I write there is infrastructure declaration code in Terraform; when I do need to do something imperative it is usually automation using the AWS API, for which I use either Python to talk to the API directly, or bash+AWS CLI (or PowerShell on Windows) for simpler workstation-based tasks. We have some local custom tools written in Python and others written in Go, which has the advantage of letting us distribute precompiled ready-to-run binaries with no module dependencies. There is some Perl and Ruby in our codebase, but no Raku yet. Outside of work I code for fun in approximately everything and contribute solutions and the occasional task to RosettaCode and answer questions on StackOverflow.

Pablo Saavedra

I’m from Argentina. I’m studying computer science since 5 five years ago. I really like music, programming, literature, movies. I just started working for a company and their major product is written in Perl. I’m really new to Perl so I thought it would be good practice for me when I get the time. I really like the language so far and I look forward to know much more about it.

Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


01. Abigail shared solutions to Task #1 and Task #2 in Awk.

02. Abigail shared solutions to Task #1 and Task #2 in Bash.

03. Abigail shared solution to Task #1 in Befunge.

04. Abigail shared solutions to Task #1 and Task #2 in C.

05. Abigail shared solutions to Task #1 and Task #2 in Lua.

06. Abigail shared solutions to Task #1 and Task #2 in Node.

07. Abigail shared solutions to Task #1 and Task #2 in Python.

08. Abigail shared solutions to Task #1 and Task #2 in Ruby.

09. Dave Jacoby shared solution to Task #2 in Node.

10. Frank Oosterhuis shared solutions to Task #1 and Task #2 in Scala.

11. Lance Wicks shared solution to Task #1 in Elm.

12. Lubos Kolouch shared solutions to Task #1 and Task #2 in Python.

13. Mohammad Meraj Zia shared solutions to Task #1 and Task #2 in Java.

14. Mohammad Meraj Zia shared solution to Task #2 in Kotlin.

15. Paulo Custodio shared solutions to Task #1 and Task #2 in Ada.

16. Paulo Custodio shared solutions to Task #1 and Task #2 in Awk.

17. Paulo Custodio shared solutions to Task #1 and Task #2 in Basic.

18. Paulo Custodio shared solutions to Task #1 and Task #2 in C.

19. Paulo Custodio shared solutions to Task #1 and Task #2 in C++.

20. Paulo Custodio shared solutions to Task #1 and Task #2 in Forth.

21. Paulo Custodio shared solutions to Task #1 and Task #2 in Lua.

22. Paulo Custodio shared solutions to Task #1 and Task #2 in Python.

23. Pete Houston shared solution to Task #1 in Awk.

24. Roger Bell_West shared solutions to Task #1 and Task #2 in Python.

25. Roger Bell_West shared solutions to Task #1 and Task #2 in Ruby.

26. Roger Bell_West shared solutions to Task #1 and Task #2 in Rust.

27. Richard Park shared solutions to Task #1 and Task #2 in APL.

28. Stuart Little shared solutions to Task #1 and Task #2 in Haskell.

29. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Clojure.

30. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Lua.

31. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Python.

32. Ulrich Rieke shared solution to Task #2 in C++.

Ulrich Rieke shared solution to Task #1 in Haskell.


Please find past solutions by respected guests. Please share your creative solutions in other languages.


TASK #1 › Pack a Spiral

Submitted by: Stuart Little

You are given an array @A of items (integers say, but they can be anything).

Your task is to pack that array into an MxN matrix spirally counterclockwise, as tightly as possible.

‘Tightly’ means the absolute value |M-N| of the difference has to be as small as possible.

Example 1:

Input: @A = (1,2,3,4)

Output:

    4 3
    1 2

Since the given array is already a 1x4 matrix on its own, but that's not as tight as possible. Instead, you'd spiral it counterclockwise into

    4 3
    1 2

Example 2:

Input: @A = (1..6)

Output:

    6 5 4
    1 2 3

or

    5 4
    6 3
    1 2

Either will do as an answer, because they're equally tight.

Example 3:

Input: @A = (1..12)

Output:

       9  8  7 6
      10 11 12 5
       1  2  3 4

or

       8  7 6
       9 12 5
      10 11 4
       1  2 3


TASK #2 › Origin-containing Triangle

Submitted by: Stuart Little

You are given three points in the plane, as a list of six co-ordinates: A=(x1,y1), B=(x2,y2) and C=(x3,y3).

Write a script to find out if the triangle formed by the given three co-ordinates contain origin (0,0).

Print 1 if found otherwise 0.

Example 1:

Input: A=(0,1), B=(1,0) and C=(2,2)

Output: 0 because that triangle does not contain (0,0).

Example 2:

Input: A=(1,1), B=(-1,1) and C=(0,-3)

Output: 1 because that triangle contains (0,0) in its interior.

Example 3:

Input: A=(0,1), B=(2,0) and C=(-6,0)

Output: 1 because (0,0) is on the edge connecting B and C.


Last date to submit the solution 23:59 (UK Time) Sunday 28th February 2021.


SO WHAT DO YOU THINK ?

If you have any suggestions or ideas then please do share with us.

Contact with me