The Weekly Challenge - 120

Monday, Jul 5, 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: Swap Odd/Even bits

10. TASK #2: Clock Angle


HEADLINES


Week #119 seems to be a memorable week. So many things happened and so fast. Domain name switch over is ongoing.

Is it coincidence the domain switch brought sudden interest and new members as listed below. I welcome each one and wish a great enjoyable journey with us.

It is with great pride, I announce, Abigail, the next Champion of The Weekly Challenge. It is an honour to have Abigail in our team. He has been consistent contributor to the weekly challenge. Not only Perl but whole bunch of guest languages. As of today, he is rank #1 as guest contributor and rank #18 in the regular leader board.

Lance is back with live video session. He has been a great influencer. Watch him live in action.

Paulo Custodio has been a great supporter of the weekly challenge. It feels nice to have such an enthusiastic member. He has now moved to rank #2 as guest contributor.

Did anyone notice James Smith participation? It reminds me of my youger days. I was like him full of energy and fight with code all the time to make it better.

The weekly challenge has made one positive change, in my humble opinion, introduced so many new guest languages. Last week, James introduced CESIL. Similary, Eric, shared Excel VBA solutions. How can Gabor stays behind, he shared solutions in Crystal. Now Gabor, being Gabor, he shared blog about it too. Task #1 and Task #2. While talking about guest contributions, I would like to welcome Richard Park after the short break. He is our inhouse APL master and shared solutions in APL. Lucas Ransan introduced a new guest language, Myrddin as well.

Last but not the least, Colin Crain. He is the one who consistently working on weekly reviews every week for so long. If you look at the quality you would agree with me, it is time taken process and definitely not easy one. I can tell you from my own experience. Getting into the skin of others code is the most difficult task when you have a team of super genious brains. I can’t thank Colin enough for his contributions.

I noticed we have 119 contributions in Perl and Raku as well as blog in the Week #119. So many co-incidence, cool.


Lance Wicks: Swap Nibbles (Week: 119)




Let us share some interesting stats from the GitHub repository.


1. Commits: 18,106 (+291)

2. Pull Requests: 4,419 (+66)

3. Contributors: 168 (+1)

4. Fork: 214 (+1)

5. Stars: 96 (+1)


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 Weekly Challenge - 119” by Mohammad S Anwar.


PERL REVIEW


Please check out Perl solutions review of the “The Weekly Challenge - 117” by Colin Crain.

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


1. Eric Cheung

I am a programmer in Hong Kong and my friend suggests me to take challenge on these two tasks.

2. Paul Fajman

I’m a meteorologist and I try to find efficiencies in my work and office through coding. I’m a self-taught perl programmer and I hope these challenges will increase my knowledge of the language. Perl is my preferred language and I’ve been using it for 12 years. I’m from Omaha, NE.

3. Belmark Caday

I would like to participate in the weekly challenge. I am from Cebu City, Philippines and I have been a Perl developer for over 8 years now.

4. Olivier Delouya, an experience Perl hacker.

5. Bruce Gray

Consultant and Contract Programmer Raku contributor Software Archeologist from Auburn, Alabama, USA.


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


Please checkout the guest contributions for the Week #119.

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


TASK #1 › Swap Odd/Even bits

Submitted by: Mohammad S Anwar

You are given a positive integer $N less than or equal to 255.

Write a script to swap the odd positioned bit with even positioned bit and print the decimal equivalent of the new binary representation.

Example

Input: $N = 101
Output: 154

Binary representation of the given number is 01 10 01 01.
The new binary representation after the odd/even swap is 10 01 10 10.
The decimal equivalent of 10011010 is 154.

Input: $N = 18
Output: 33

Binary representation of the given number is 00 01 00 10.
The new binary representation after the odd/even swap is 00 10 00 01.
The decimal equivalent of 100001 is 33.

TASK #2 › Clock Angle

Submitted by: Mohammad S Anwar

You are given time $T in the format hh:mm.

Write a script to find the smaller angle formed by the hands of an analog clock at a given time.

HINT: A analog clock is divided up into 12 sectors. One sector represents 30 degree (360/12 = 30).

Example

Input: $T = '03:10'
Output: 35 degree

The distance between the 2 and the 3 on the clock is 30 degree.
For the 10 minutes i.e. 1/6 of an hour that have passed.
The hour hand has also moved 1/6 of the distance between the 3 and the 4, which adds 5 degree (1/6 of 30).
The total measure of the angle is 35 degree.

Input: $T = '04:00'
Output: 120 degree


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


SO WHAT DO YOU THINK ?

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

Contact with me