Weekly Coder
95 subscribers
84 photos
6 videos
1 file
73 links
Byte sized weekly coding challenges to hone your problem-solving prowess.
Download Telegram
๐Ÿšด To Move Invites Wear

A bike is equipped with a sensor that tracks the total number of tire rotations. The diameter of a typical bike tire is 66cm and is rated to last Total Distance (D) 3,000 km before it wears.

๐Ÿฅ… Goal: Write a program that takes the number of tire rotations as input and calculate:
- the total distance traveled in kms using the entered tire rotations
- the remaining kilometers and rotations before the tire needs to be replaced

โœ๏ธ Recommended Learning:
- Arithmetic Operators, Constants (PI)
- Arc Length (C): C = 2ฯ€r
- Number of Rotations (N): N = D / C

โšก๏ธ Bring the thunder!
- Introduce Wear Factor: read more here
- Display also the current wear percentage of the tire based on the traveled distance.

๐Ÿช Send your submissions in the comments!

@WeeklyCoder | Week 49
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿ–ผ It's lenticular time!

You've seen them before. Lenticular prints create mesmerizing illusions of depth, motion, or transformation by blending multiple images into one dynamic visual experience.

With a simple change in perspective, these prints captivate the eye, bringing 3D effects or animated transitions to life without the need for special glasses or devices.

And these week, let's try and simulate them like the video above.

๐Ÿฅ… Goal: Given a series of images, use the mouse cursor to hover over from side to side to simulate a lenticular print. Like this.

โœ๏ธ Recommended Learning:
- PImage, loadImage (), image ()
- arrays, loops, concatenation
- map (), mouseX

โšก๏ธ Bring the thunder!
- use tools like ezgif to split your own GIFs to images and use them in your code.

๐Ÿช Send your submissions in the comments!

@WeeklyCoder | Week 50
๐Ÿœ Only a matter of time!

Termites multiply fast, but their survival depends on food supply. How long can a termite colony survive with limited resources?

This week, let's simulate how long a colony can last before they run out of resources โ€” before they perish (as they will).

๐Ÿฅ… Goal: Given an initial population, a growth rate, and a fixed food supply, calculate how long a termite colony can survive before their food runs out.

Output each population step and how much food is left until itโ€™s game over!

Starting figures here.

โœ๏ธ Recommended Learning:
- loops
- selection statements
- operators

โšก๏ธ Bring the Thunder!
- What if some termites could produce food? Add that to the run.
- What if some termites have gatherings that increases their food consumption?

๐Ÿช Send your code in the comments!

@WeeklyCoder | Week 51
๐ŸŽ‰ Weekly Coder Turns One! ๐ŸŽ‚

That's right! It's already been one whole year! That's 52 projects. And if you've been following along, that's one project a week to work your programming muscles. Your abs showing yet?

๐ŸŽ Thanks for being here. Hope you're finding the contents here useful. Hope you're acting on them. Do.

๐Ÿงฌ Let's invite Levenshtein to celebrate.

DNA sequences can be millions of characters long, and even tiny mutations can lead to serious consequences โ€” making manual identification of every difference between two sequences practically impossible.

Objective here.
Example here.

๐Ÿฅ… Goal: Given two long DNA sequences, calculate how many mutations are required to transform one sequence into the other.

โš™๏ธ Starting pairs here

โœ๏ธ Recommended Learning:
- Loops
- Conditionals (if statements)
- String comparison

โšก๏ธ Bring the Thunder!
- What if the sequences are of different lengths?
- Say where the mutations are by listing out their location.

๐Ÿช Send your code in the comments!

@WeeklyCoder | Week 52
๐ŸŽ‰8
๐Ÿ“ฒ T9 Keypad Ciphering

Before smartphones, feature phones were the norm. Using the T9 (multi-tap) number pads to text, dial, and interact. Each number represented multiple letters (e.g., 2 for ABC, 3 for DEF), and typing required multi-presses of a single key.

This week, let's recreate that experience with ciphering twist!

๐Ÿฅ… Goal: Encode and decode text messages based on the feature phone keypad system. โ€” Convert text to keypad sequences.

Example: "Weekly Coder" โž” 9 33 33 55 555 999 / 222 666 3 33 77

Keypad Reference here.

โœ๏ธ Recommended Learning:
- StringDict, split
- Selection Statements, loops
- Arrays
- Concatenation

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 53
๐Ÿ‹๏ธโ€โ™‚๏ธ The 1 Rep Max (1RM)

1RM is the maximum weight a person can lift for a single rep (repetition). Itโ€™s a key benchmark for strength and allows lifters to structure their workouts based on training intensity.

๐Ÿฅ… Goal: This week, let's create a program that lets lifters insert the weight they lift and reps they completed and use the Epley formula to calculate their 1RM.

For instance, if a person can lift 10 kg for 15 reps, their estimated 1RM using the Epley formula is: 15kg. That means, the maximum weight they can lift is 15kg โ€” a single rep.

Training Intensity Categorization: here

โš™๏ธ Task:
- Let users insert the weight they lift and reps
- Let your program calculate 1RM using Epley's formula
- Let it then tell in kgs what the Training Intensity classifications are for them

โœ๏ธ Recommended Learning:
- operators, variables
- concatenation

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 54
๐ŸŽ Regenerative Breaking

Regenerative braking in electric cars helps recharge the battery by converting kinetic energy back into electricity. However, the energy recovery rate is not purely linearโ€”it depends on speed and braking duration.

This week, let's build a program that estimates how much energy can be recovered during braking using a more realistic efficiency model.

๐Ÿฅ… Goal: Let's create a program that calculates the energy regenerated while keeping in mind that energy recovery is highest at moderate speeds and decreases at both low and high speeds.

๐Ÿ”‹ Non-Linear Energy Recovery Formula: here.

โš™๏ธ Task: Let users insert the car's speed (in km/h) and braking duration (in seconds).

Calculate then the total energy recovered using the formula above.

โœ๏ธ Recommended Learning:
- operators, variables
- input handling
- pow (, )

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 55
๐Ÿ–ฅ It's your turn!

Let's have an open projects submission this week. What kind of projects have you worked on since the beginning of Weekly Coder?

Whether that's a small one hour project or one that took months to finish, let you submit your best (max. of 5) projects here.

Share your works in the comments.

@WeeklyCoder | Week 56
๐Ÿ‘1
Weekly Coder
๐Ÿ–ฅ It's your turn! Let's have an open projects submission this week. What kind of projects have you worked on since the beginning of Weekly Coder? Whether that's a small one hour project or one that took months to finish, let you submit your best (max. ofโ€ฆ
๐Ÿ™ˆ Did you just miss a prize of Monthly Unlimited Internet & Voice Package by not partaking in last week's challenge?

Of course you did.

Let's see who learns. Challenge extended till next Thursday 23:59.

๐ŸŽ The prizes of then maybe bigger, maybe not. Only one way to find out.

Share your works in the comments.

@WeeklyCoder | Week 57
๐Ÿž Let's make something delicious this week!

Bakers have a system called "Bakers' Percentage" where the weight of each ingredient is expressed as a percentage of the flour weight, which is always 100%.

This simplifies scaling and recipe adjustments, as all other ingredients are calculated relative to the flour.

๐Ÿฅ… Goal: Create a program that, given the desired weight (g) of a loaf of bread, that calculates the amount of ingredients required โ€” taking account a 15% loss in weight of dough when becoming a bread after baking.

๐Ÿ‘‰ Base this Sheets to see details and get your formulae.

Eg:
- Input: weight of bread (g): 100
- Output: Flour (70.25g), Water (42.15ml), Yeast (0.84g), Salt (1.41), and Improver (0.35).

โœ๏ธ Recommended Learning:
- operators, variables
- input handling
- rounding, concatenation

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 58
๐Ÿ’ฐ Receipt Detective

A cashier at a boutique is tasked to verify the validity of a transaction using an RN (Reference Number). To do this, she manually creates a link using an RN and the last 8 digits of their account number.

Template Link:
https://apps.cbe.com.et:100/?id=<REFERENCE NUMBER><LAST 8 DIGITS>

Boutique's last 8 digits: 61108592
Example RN: FT24341HNN9T

Receipt Link:
https://apps.cbe.com.et:100/?id=FT24341HNN9T61108592

๐Ÿฅ… Goal: Given the account number of the boutique is always the same, let you take as an input the RN from a user and verify the transaction.

๐Ÿพ Steps:
- take RN as input from user
- use the RN and 8 last digits of the account number to build the receipt URL
- let your code download the PDF receipt using the URL
- load the PDF and obtain its contents as text (example here)
- extract useful information and do the verification

๐Ÿ“… Submissions: Sunday Morning, 2:00 LT

๐Ÿช Send your submissions in the comments!

@WeeklyCoder | Week 59
๐Ÿ”ฅ3
๐Ÿคš๐Ÿ– Wo wo wo! But can you paint?

Let's build a simple paint app this week. Much like MS Paint, let it allow to draw, erase, and save on a digital canvas.

๐Ÿฅ… Goal: create a program that allows users to draw on a canvas with the following features:
- brush Tool: Choose a shape (circle, square, triangle, or plus) to draw with.
- brush size: Offer finite options for brush sizes.
- color tool: Choose a color (could be random or via a color picker/input dialog).
- eraser tool: Erase parts of the drawing.
- clear canvas: An option to start fresh.

โœ๏ธ Recommended Learning:
- mouseX, mouseY, pmouseX, pmouseY
- mousePressed, mouseReleased, mouseDragged
- point (), line ()
- saveFrame ()

๐Ÿช Submit your creations in the comments!

@WeeklyCoder | Week 60
โœ… The To-Not-Do List

A "to-not-do list" is a list of things you want to avoid doing. Whether that's unhelpful habits or vices, the goal is to eliminate unproductive activities to free up time for what truly matters.

๐Ÿค” We're borrowing Charlie Munger's Inversion Thinking this week. Instead of asking how to succeed, ask how to fail and then avoid those pitfalls.

๐Ÿฅ… Goal: create a program that helps users manage their unproductive habits by tracking what they successfully avoided in a day

โœ๏ธ Example of a to-not-do list:
- binge Social Media for more than 30mins
- procrastinate โ€” do not start that assignment
- stay up and wake up late
- hit snooze button when alarm goes off
- drink less than 2L water a day
- do not participate in WeeklyCoder

โš™๏ธ Task: here

๐Ÿ”จ Usage: here

โœ๏ธ Recommended Learning:
- IntDict (Str - int pair โ€” 1 check, 0 uncheck)
- input handling
- mouseClicked
- keyTyped

โšก๏ธ Introduce streaks, badges, and progress indicators.

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 61
This media is not supported in your browser
VIEW IN TELEGRAM
๐ŸŽพ Let's bounce!

This week's challenge is a game that hardly needs a description. Watch and recreate!

โœ๏ธ Recommended Learning:
- variables, arithmetic & logical operators
- background, mouseClicked, functions

โšก๏ธ Use APDE to make a real Android game from your Processing sketch!

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 62
๐Ÿ”ฅ2
This media is not supported in your browser
VIEW IN TELEGRAM
๐ŸŽ Tap Snap

This week, let's see how quickly you can respond to a visual stimulus. The rule is simple, tap your screen the moment a shape appears.

๐Ÿฅ… Goal:
Create a game that measures and displays a player's reaction time after showing a shape on the screen for a random duration.

๐ŸŽฎ Game Flow:
1. A random delay hides the shape
2. The shape appears on the screen
3. Player reacts by tapping their screen
4. The program records and displays the reaction time (best time & last time)

โš™๏ธ Random Time Boundary: use 500ms (min time) - 3500ms (max time)

โœ๏ธ Recommended Learning:
- millis ()
- text (), textSize (), textAlign ()
- random ()
- casting
- if, mousePressed

โšก๏ธ Bring the Thunder: here

๐ŸŽ Special gifts for any 3 who first recreate the game and set sub-200ms, sub-150ms, and sub-130ms reaction times! Only until Christmas!

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 63
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿ Psst ...

How are we on week 64 without having made a snake game already? Beats me!

๐Ÿฅ… Goal: Recreate the classic Snake game.

โœ๏ธ Recommended Learning:
- Arrays or Lists
- PVector
- Loops
- keyPressed (), keyCode

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 64
โšก1
๐Ÿงฉ It's Anagram time!

An anagram is a word, phrase, or name formed by rearranging the letters of another, such as "cinema" formed from "iceman."

๐Ÿฅ… Goal:
- Create a program that, given a word, finds all possible anagrams from a predefined list or dictionary.

๐ŸŽฎ Game Flow:
- user inputs a word
- the program searches through a dictionary for words that are anagrams of the input
- display all found anagrams or a message if none exist

โš™๏ธ Words List: here [370,000 + words]

โœ๏ธ Recommended Learning:
- loadStrings (),
- .sort (),
- loops and nested loops,
- List

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 65
๐Ÿ“ž DTMF Tones!

The Dual-Tone Multi-Frequency (DTMF) system is how phones dialers send signals to dial numbers.

These signals are commonly heard on telephone dial pads. Each tone is simply the sum of two sine waves โ€” one from a low-frequency group and one from a high-frequency group.

๐ŸŽต Listen to a sample dial tone here.

๐ŸŒ Click here and interact with an online DMTF generator.

๐Ÿฅ… Goal: create a program that accepts a phone number as input and produces tones for each digit as if it were pressed on a physical phone keypad. Include pauses between tones for clarity.

๐Ÿฆถ Get started

โš™๏ธ Recommended Learning:
- Array/ArrayList
- Minim Library โ€” for sound generation using oscillators like Oscil
- PVector โ€” for paired digits
- .toCharArray (), .indexOf (), str (), โ€” for String manipulation
- delay () โ€” add pauses between tones

๐Ÿ‘Œ This is the first part of a two-part challenge for an epic project we'll complete next week. Can you guess what part 2 will be?

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 66
๐Ÿ“ž DTMF Tones 2!

In the TV series Fringe (Season 1 Episode 19 - 36:00-36:44), Olivia hears dialing tones from an abduction's recording and uses an app to decode them into the phone number that was called. By tracing this number, she identifies the perpetrator, pushing the investigation forward.

Let's continue on last week's challenge and create a similar tool this time.

๐ŸŽต Listen to a sample dial tone here.

๐Ÿฅ… Goal: create a program that accepts dialing tones as an input (.wav file or other) and outputs the numbers decoded.

โš™๏ธ Recommended Learning:
- Array/ArrayList
- Minim Library โ€” for sound generation using oscillators like Oscil

๐Ÿช Submit your code in the comments!

@WeeklyCoder | Week 67
๐Ÿ–ฅ It's your turn, again.

Let's have an open projects submission this week. What projects have you been working on since last time?

Whether that's a small one hour project or one that took weeks to finish, let you submit your best (max. of 3) projects here.

Share your works in the comments.

@WeeklyCoder | Week 68