r/letscodecommunity • • Jan 11 '26

Give an honest review, I am in 11th grade and a beginner in python coding.

5 Upvotes
import turtle
import random


# Constants
BOUNDARY = 290
PLAYER_SPEED = 2
GOAL_SPEED_RANGE = (2, 5)
MAX_GOALS = 8
GAME_TIME = 60  # seconds


# Screen setup
w = turtle.Screen()
w.bgcolor('black')
w.title('Collect the Goals!')
w.tracer(0)  # manual screen updates for smoother animation


# Border
border_pen = turtle.Turtle()
border_pen.color('white')
border_pen.penup()
border_pen.setposition(-BOUNDARY, -BOUNDARY)
border_pen.pendown()
border_pen.pensize(3)
for side in range(4):
    border_pen.forward(BOUNDARY * 2)
    border_pen.left(90)
border_pen.hideturtle()


# HUD pens
score_pen = turtle.Turtle()
score_pen.color('white')
score_pen.hideturtle()
score_pen.penup()
score_pen.setposition(-BOUNDARY, BOUNDARY + 20)


timer_pen = turtle.Turtle()
timer_pen.color('white')
timer_pen.hideturtle()
timer_pen.penup()
timer_pen.setposition(100, BOUNDARY + 20)


message_pen = turtle.Turtle()
message_pen.color('yellow')
message_pen.hideturtle()
message_pen.penup()
message_pen.setposition(0, 0)


# Shapes to cycle through
SHAPES = ["triangle", "square", "circle", "turtle"]
current_shape_index = 0
colors=['purple','blue','white','green']
current_color_index = 0
# State
score = 0
high_score = 0
time_left = GAME_TIME
game_running = True



class Player(turtle.Turtle):
    def __init__(self):
        super().__init__()
        self.color('purple')
        self.shape('triangle')
        self.penup()
        self.speed(0)
        self.speed_value = PLAYER_SPEED


    def move(self):
        self.forward(self.speed_value)
        # Bounce off walls
        if abs(self.xcor()) > BOUNDARY or abs(self.ycor()) > BOUNDARY:
            self.right(180)


    def turn_left(self):
        self.left(30)


    def turn_right(self):
        self.right(30)


    def increase_speed(self):
        self.speed_value += 1


    def decrease_speed(self):
        self.speed_value = max(1, self.speed_value - 1)  # prevent negative speed



class Goal(turtle.Turtle):
    def __init__(self):
        super().__init__()
        self.color('red')
        self.shape('circle')
        self.penup()
        self.speed(0)
        self.setposition(random.randint(-BOUNDARY, BOUNDARY),
                         random.randint(-BOUNDARY, BOUNDARY))
        self.setheading(random.randint(0, 360))
        self.move_speed = random.randint(*GOAL_SPEED_RANGE)


    def move(self):
        self.forward(self.move_speed)
        # Bounce off walls
        if abs(self.xcor()) > BOUNDARY or abs(self.ycor()) > BOUNDARY:
            self.right(180)



def is_collision(t1, t2):
    return t1.distance(t2) < 20



def change_player_shape():
    global current_shape_index,current_color_index
    current_shape_index = (current_shape_index + 1) % len(SHAPES)
    player.shape(SHAPES[current_shape_index])
    current_color_index =  (current_color_index + 1) % len(colors)
    player.color(colors[current_color_index])
# Game setup
player = Player()
goals = [Goal() for _ in range(MAX_GOALS)]



def update_score():
    score_pen.clear()
    score_pen.write(f"Score: {score}  |  High: {high_score}",
                    align='left', font=('Consolas', 15, 'normal'))



def update_timer():
    global time_left, game_running
    timer_pen.clear()
    timer_pen.write(f"Time: {time_left}", align='left', font=('Consolas', 15, 'normal'))
    if time_left > 0:
        time_left -= 1
        w.ontimer(update_timer, 1000)  # call again after 1 second
    else:
        game_running = False
        end_game()



def end_game():
    global high_score
    # Update high score
    if score > high_score:
        high_score = score


    # Show final message
    message_pen.clear()
    message_pen.write(f"Time's up!\nFinal: {score}  |  High: {high_score}\nPress R to restart",
                      align='center', font=('Consolas', 18, 'bold'))


    # Stop goals moving (optional: hide them)
    for g in goals:
        g.hideturtle()



def restart_game():
    global score, time_left, game_running, current_shape_index
    # Reset state
    score = 0
    time_left = GAME_TIME
    game_running = True
    current_shape_index = 0


    # Clear HUD
    message_pen.clear()
    score_pen.clear()
    timer_pen.clear()


    # Reset player
    player.showturtle()
    player.setposition(0, 0)
    player.setheading(0)
    player.shape(SHAPES[current_shape_index])


    # Reset goals
    for g in goals:
        g.showturtle()
        g.setposition(random.randint(-BOUNDARY, BOUNDARY),
                      random.randint(-BOUNDARY, BOUNDARY))
        g.setheading(random.randint(0, 360))


    update_score()
    update_timer()  # restart countdown



# Keyboard bindings
w.listen()
w.onkeypress(player.turn_left, 'Left')
w.onkeypress(player.turn_right, 'Right')
w.onkeypress(player.increase_speed, 'Up')
w.onkeypress(player.decrease_speed, 'Down')
w.onkeypress(restart_game, 'r')  # press R to restart after time's up



# Main game loop
def game_loop():
    global score
    if game_running:
        player.move()


        for goal in goals:
            goal.move()
            if is_collision(player, goal):
                goal.setposition(random.randint(-BOUNDARY, BOUNDARY),
                                 random.randint(-BOUNDARY, BOUNDARY))
                goal.setheading(random.randint(0, 360))
                score += 1
                update_score()
                change_player_shape()   # transform on collision


    w.update()
    w.ontimer(game_loop, 20)  # repeat every 20ms



# Start game
update_score()
update_timer()
game_loop()
w.mainloop()

r/letscodecommunity • • Jan 10 '26

Is full stack worth it in this job market?

14 Upvotes

Hello everyone. I am a 3rd year engineering student and currently in my journey to learn fullstack . I see everyone around doing ai/ml,cloud,Devops, Cybersecurity. I am getting confused that the stack I have choose is right or not. Will I get an internship or a job in this market when everything is revolving around ai. Please help and share your opinion about it.


r/letscodecommunity • • Dec 15 '25

CP resources

7 Upvotes

Please someone drop links to CP resources and Leetcode resources. I am looking for algozenith, tle eliminatiors all level. Also Leetcode patterns from educative and grokking resources. Pls share them here


r/letscodecommunity • • Dec 15 '25

Please aggregate links

6 Upvotes

There are so many resources scattered here. Pls create an aggregated gist or something so that everyone can easily access it.


r/letscodecommunity • • Dec 04 '25

ZL Tech employee review

3 Upvotes

r/letscodecommunity • • Nov 17 '25

I literally have 23 hours for my startup to survive

19 Upvotes

Hey everyone, I’m a student + early stage founder building an AI powered cofounder matchmaking platform in Bangalore. To test our matching algorithm in the real world, we designed a 10 day mini AI startup cohort where participants form teams, build an MVP with mentor guidance, and pitch to investors/enablers at the end. I somehow managed to pull off things I didn’t think were possible at this stage:

  • Confirmed 3 mentors (AI consultant, GTM strategist, Business consultant)
  • Locked venue for offline days
  • Got investor/enabler availability
  • Structured the full 10 day sprint
  • Set the price at ₹1099 literally breakeven

Out of 22 people who initially showed interest, I needed 15 for conversion. Right now… I have 6 confirmed. And I have 23 hours left before I have to cancel everything. This is not just our cohort failing, if this doesn’t run, it breaks my credibility with the mentors, the investors, the venue partners and with my own team. It also means the 6 people who trusted me enough to register will end up losing the experience.

So I’m stuck... I need 9 more people and honestly, it’s not even about sales anymore. It’s about not letting something collapse that so many people already committed their time to. Not asking for pity but advice. What would you do in my position?

How would you get 9 more committed people in under 24 hours?

Where would you post?

What angle would you pitch?

What messaging would make someone sign up?

What would YOU want from a 10-day sprint like this?

Any guidance, even one small suggestion, would help a lot. Thanks for reading, and for helping a fellow builder out. 


r/letscodecommunity • • Nov 10 '25

Building a Healthcare Product? Here’s Where You’ll Find the Clarity You Need.

Post image
1 Upvotes

🌟 Building a Healthcare Product? Here’s Where You’ll Find the Clarity You Need.

We all build amazing products — but when it comes to healthcare, things get complex. You don’t just build features… you build trust, compliance, and care.

💭 Ever wondered how hospitals actually evaluate new products? Or why so many healthcare startups struggle to scale despite great tech?

This session will answer that.

Join us for an evening that bridges the gap between innovation and real healthcare practice. Learn from doctors, CXOs, and innovators who’ve built and scaled within India’s healthcare ecosystem.

🎯 Event: How to Build Healthcare Products that Matter 🗓️ Date: 14th November (Friday) 🕕 Time: 6:00 PM – 9:00 PM 📍 Venue: KDEM, Bengaluru 🎟️ Ticket: ₹1200 (includes dinner + networking)

🎫 Limited seats — only 60 spots. 👉 Register now: https://luma.com/ahef4ibo

Regards, Mustafa Shariff 6366320871

Let’s build healthcare that truly cares. 💙


r/letscodecommunity • • Nov 01 '25

How do you decide when a feature is "too advanced" for MVP, even when it's objectively valuable?

1 Upvotes

I just wrote about this exact dilemma with our Hotspot Analysis & Decarbonization Module. Super cool feature, genuine user need, but adding it to MVP would have:

  • Delayed our entire launch
  • Created dependencies we couldn't manage

The hard truth: Not everything belongs in MVP, even when stakeholders really, really want it.

Wrote up the full story: 4 unexpected challenges, 4 hard-earned learnings, and why documentation saved our sanity: https://ektaghadle.substack.com/p/building-the-decarbonization-puzzle

Curious how others handle scope decisions for complex, multi-industry products? 


r/letscodecommunity • • Oct 25 '25

Whether you like it or not, customization is the biggest TRAP in B2B SaaS Software!

2 Upvotes

Quick poll: Who here has lost sleep over saying "no" to a customization request that could close a major deal?

Just wrote about the customization paradox in B2B SaaS, focusing on my experience in ESG software, but the lessons apply broadly.

TL;DR: Customization closes deals but can destroy your product if not managed strategically. I break down 4 major challenges (including the PM dilemma we all face).

Blog link: https://substack.com/home/post/p-177085990

Would especially love to hear how other PMs handle the tension between sales pressure and product integrity. DM your strategies to me!


r/letscodecommunity • • Sep 29 '25

📌 Sorting Algorithm Series – Part 2: Selection Sort

1 Upvotes

10 years ago, when I first learned algorithms, Selection Sort was introduced to me in the most boring way possible.

➡️ A bunch of formulas.
➡️ Some pseudo-code.
➡️ Zero intuition.

And I remember thinking:
“Okay… but how does this actually work in practice?”

Turns out, Selection Sort is one of the simplest — yet most misunderstood — sorting algorithms.

🔎 What Selection Sort Really Does

Think of it like this:

  • You’re standing in a line of people of different heights.
  • You want to arrange them from shortest to tallest.
  • What do you do?

    • Find the shortest person.
    • Bring them to the front.
    • Repeat the process for the rest of the line.

That’s exactly how Selection Sort works.

✅ Why This Breakdown is Different

In this post, you’ll get:

  • A plain-English explanation (no jargon)
  • When to use it (and when you really shouldn’t)
  • Time complexity explained in context
  • A step-by-step example flow
  • A visualization of the array at each step
  • The algorithm + code (with comments)

I promise — after reading this, Selection Sort will feel obvious.

🖼️ Visualization + Code

I’ve shared a detailed walkthrough of the code + visualization here 👇

🔗 Check the full breakdown

🚀 What’s Next

This is the second post in my Sorting Algorithm Series (after Bubble Sort).

Up next → Insertion Sort (a natural progression you’ll love).

💡 If you found this useful, subscribe for free to receive new posts in your inbox and support my work:
👉 Subscribe here