Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
150639 stories
·
33 followers

The Meta Management Gamble and Why We're Worried Every Other Company Will Copy It

1 Share

Meta just announced a 1:50 manager-to-employee ratio for their new AI engineering team, and Bob and Josh have opinions. They debate what management is actually for, whether AI can substitute for real leadership, and why they're more worried about who copies this experiment than whether Meta pulls it off.


Stay Connected and Informed with Our Newsletters

Josh Anderson's "Leadership Lighthouse"

Dive deeper into the world of Agile leadership and management with Josh Anderson's "Leadership Lighthouse." This bi-weekly newsletter offers insights, tips, and personal stories to help you navigate the complexities of leadership in today's fast-paced tech environment. Whether you're a new manager or a seasoned leader, you'll find valuable guidance and practical advice to enhance your leadership skills. Subscribe to "Leadership Lighthouse" for the latest articles and exclusive content right to your inbox.

Subscribe here

Bob Galen's "Agile Moose"

Bob Galen's "Agile Moose" is a must-read for anyone interested in Agile practices, team dynamics, and personal growth within the tech industry. The newsletter features in-depth analysis, case studies, and actionable tips to help you excel in your Agile journey. Bob brings his extensive experience and thoughtful perspectives directly to you, covering everything from foundational Agile concepts to advanced techniques. Join a community of Agile enthusiasts and practitioners by subscribing to "Agile Moose."

Subscribe here

Do More Than Listen:

We publish video versions of every episode and post them on our YouTube page.

Help Us Spread The Word: 

Love our content? Help us out by sharing on social media, rating our podcast/episodes on iTunes, or by giving to our Patreon campaign. Every time you give, in any way, you empower our mission of helping as many agilists as possible. Thanks for sharing!

 





Download audio: https://episodes.captivate.fm/episode/f7ee3481-7500-4671-aaf4-7943961b14ea.mp3
Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

Microsoft’s Copilot makes Anthropic’s Claude and OpenAI’s GPT team up

1 Share

Microsoft’s AI strategy has, for the most part, been about using third-party large language models (LLMs). First this was mostly about using OpenAI’s GPT models, but more recently, this also included Anthropic’s Claude — and now Microsoft is using both of them in tandem to improve Copilot’s Researcher agent.

The Researcher agent, which Microsoft recommends for problems where deeper reasoning or problem solving across multiple sources is necessary, now includes an optional ‘critique’ feature. With this, GPT will write the draft, which Claude then reviews. As Microsoft notes in its announcement, this review will include checks for “accuracy, completeness, and citation integrity.”

In the future, Microsoft says, it may also give users the option to switch this flow around and have Claude write and GPT check.

Claude and GPT: Better together?

This workflow may feel a bit hacky at first, but it’s also not all that different from how developers sometimes use one model to write the code and another — from a different model family — to do the code review.

At least in Microsoft’s benchmark, this approach also shows some clear advantages. Using Perplexity’s deep research DRACO benchmark, Anthropic’s Claude Opus 4.6 scores 42.7 by itself and 50.4 within Perplexity’s Deep Research mode. Copliot’s Researcher with Critique turned on scores 57.4, higher than any of the individual models.

Credit: Microsoft.

Sadly, we don’t have benchmarks for OpenAI’s GPT-5.4 yet, but chances are its score would be in the same range as Opus 4.6’s.

Another new feature for research with Copilot is the so-called ‘council.’ This allows users to compare how different models handle a query side-by-side.

Cowork is now in the M365 Frontier Program

Recently, Microsoft also announced that it would bring Anthropic’s Claude Cowork tool — essentially Claude Code for knowledge workers who need long-running agents who can complete multi-step workflows — to Copilot.

Imaginatively named Copilot Cowork, this feature is now available in the early-access Microsoft 365 Frontier program.

Credit: Microsoft.

Microsoft’s advantage here is that many of its customers would be worried about using Cowork if they had to upload their data to Anthropic. But since these companies already use Microsoft 365 and the Copilot Cowork data stays within their control (Cowork runs in a sandboxed cloud environment), this now enables them to take advantage of these new tools.

“This isn’t about generating content or answers. It’s about taking real action – connecting steps, coordinating tasks, and following through across everyday workflows,” says Barton Warner, SVP of
Enterprise Technology at Capital Group. “Because Cowork operates on our enterprise data and within our security and risk boundaries, we can experiment, learn, and scale with confidence. That allows us to move faster and focus AI in places where it actually delivers value.”

Why is Microsoft doing this?

Having to bring in Anthropic to ship features like Cowork and Critique does say something about the position Microsoft finds itself in now: it is diversifying away from its early reliance on OpenAI, but in doing so, it is also deepening its relationship with yet another model provider. For customers paying premium prices for Copilot, one question on their minds is surely whether the value in using Microsoft’s services lies in the models it orchestrates or in the enterprise data and trust layer that makes those models useful in the first place.

Microsoft is clearly betting it’s the latter, while for Anthropic, this partnership is yet another step in its play to become the AI vendor for the enterprise.

When Microsoft first announced Cowork, its president of business applications and agents Charles Lamanna noted that “it is this multi-model advantage that makes Copilot different.” If Microsoft had its own frontier models, it would likely take a different approach, but as things stand, this is the best approach it can take.

The post Microsoft’s Copilot makes Anthropic’s Claude and OpenAI’s GPT team up appeared first on The New Stack.

Read the whole story
alvinashcraft
12 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Launching Passkeys support on Report URI! 🗝️

1 Share
Launching Passkeys support on Report URI! 🗝️

As we're always wanting to keep ahead in the security game, I'm happy to announce that we now support Passkeys on Report URI! Let's take a quick look at what Passkeys are, why you should use them, and how we've implemented them.

Launching Passkeys support on Report URI! 🗝️

Passkeys solve a big problem

Let's kick things off by stating the biggest benefit of Passkeys which is that they are phishing-resistant! That's right, if you're using Passkeys to protect your account, you no longer have to worry about falling victim to a phishing attack. This was the primary driver for us to add support at Report URI, to provide our customers with a strong authentication mechanism that will give them confidence they are protected against the pervasive threat of phishing attacks. On top of this tremendous benefit, I feel that they're also much more convenient to use too!

How do Passkeys work?

Instead of relying on a secret piece of information like a password, Passkeys work by relying on cryptography and are surprisingly simple under the hood. Your device will create a cryptographic key pair that will be used for authentication when you need to login to the website. The registration process for a Passkey looks like this:


 User               Browser / OS              Website / Server            
 |                      |                           |
 | 1. "Create Passkey"  |                           |
 |--------------------->|                           |
 |                      | 2. Request registration   |
 |                      |-------------------------->|
 |                      |                           |
 |                      | 3. Send challenge         |
 |                      |<--------------------------|
 |                      |                           | 
 |                      | 4. Create new key pair    |
 |                      |    - save private key     |
 |                      |      on device            | 
 |                      |                           |
 |                      | 5. Send public key + attestation
 |                      |-------------------------->|
 |                      |                           | 7. Store public key
 |                      |                           |    with user account
 |                      | 8. Registration complete  |
 |                      |<--------------------------|
 | 9. "Registration Complete"                       |
 |<---------------------|                           |
 |                      |                           |

You initiate the Passkey registration process in the browser and you will be prompted by your device or password manager to create a Passkey. You device will create the cryptographic key pair, sign the challenge provided by the website, and then return the signed challenge along with your public key, which is stored against your account. The private key is kept securely on your device. Now that Passkey registration is complete, you can then use your Passkey for authentication.

User               Browser / OS              Website / Server
 |                      |                           |
 | 1. "Sign in with passkey"                        |
 |--------------------->|                           |
 |                      | 2. Request authentication |
 |                      |-------------------------->|
 |                      |                           | 
 |                      | 3. Send challenge         |
 |                      |<--------------------------|
 |                      |                           |
 |                      | 4. Biometrics / PIN       |
 |                      | 5. Sign with private key  |
 |                      | 6. Return signed challenge|
 |                      |-------------------------->|
 |                      |                           | 7. Verify signature
 |                      |                           |    using public key
 |                      | 8. Authentication successful
 |                      |<--------------------------| 
 | 9. "Signed in!"      |                           |
 |<---------------------|                           |

When logging in to a website where you have registered a Passkey, you will usually have to initiate the process to sign in with your Passkey. In the background, your device will then start the authentication process and receive the challenge that needs to be signed with your private key. To do that, your device will ask for something like FaceID, TouchID, or similar on your device to authenticate you. Once you have authenticated to your device, it will sign the challenge with your private key and return it to the website. The website can then check it is definitely you by verifying that signature using your public key that it previously received, and then you're logged in! This is such a nice experience and has so little friction for the user, especially when you consider how strong this mechanism is.

How are they phishing-resistant?

When your device creates a Passkey, it doesn't just create and store the keys used, it also stores some important metadata too. The relevant part of that metadata that gives us phishing resistance is the Relying Part ID, or rpId. When you go to Report URI and register a Passkey on our website, the rpId will be saved with the Passkey on your device as report-uri.com and your device can then enforce that your new Passkey is only ever used on this domain or its subdomains. This means that if you end up on a phishing site that looks like Report URI, but isn't actually report-uri.com, the Passkey simply will not work. Take these examples that might make for convincing phishing pages:

https://report-url.com               <-- nope
https://report-uri.secure-login.com  <-- nope
https://report-uri.xyz               <-- nope

The only way that your device will now use the Passkey to log you in is if you're on a valid website where the Passkey is allowed to be used, effectively neutralising the threat of phishing!

How are they being used on Report URI?

There are two ways that you can use Passkeys on your website and they offer slightly different benefits.

  1. You can use Passkeys to replace passwords altogether, so they become your primary authentication mechanism.
  2. You can use Passkeys as a 2FA mechanism alongside your existing username/password authentication.

At Report URI we've opted for option #2 and now offer Passkeys as a 2FA option alongside our existing TOTP 2FA offering. Passkeys make for an incredibly strong second-factor and our primary goal was to achieve the phishing resistance that Passkeys offer. Looking at option #1 is also a valid approach and there are other benefits too, mainly being able to get rid of passwords from your database and protect against password based attacks. Given our extensive measures to protect user passwords, it was less of a concern for us to move to using Passkeys as our primary authentication mechanism and instead we chose to introduce them as a 2FA mechanism. If you're interested in our approach to securing user passwords, you can read my blog post that goes in to detail, but here is a summary:

  1. We use the Pwned Passwords API to prevent the use of passwords that have previously been leaked.
  2. We use zxcvbn to ensure the use of strong passwords when registering an account or changing password.
  3. We provide extensive support for password managers using attributes on HTML form elements.
  4. We store hashed passwords using bcrypt (work factor 10 + 128bit salt) so they are resistant to cracking.

Passkeys are now available on the Settings page in your account and we strongly recommend that you go and enable them!

In the coming week, I will also be publishing two more blog posts. One of them is the full details of the external engagement to have our Passkeys implementation audited. We engaged a penetration testing company to come in and do a full test of our implementation to make absolutely sure it was rock solid. The blog post will contain the full, unredacted report with details of all findings. The second blog post will be the announcement of our whitepaper on Passkeys and the new security considerations they bring if you're planning to use them on your site. Make sure you're subscribed for notifications so you know when they go live!

Read the whole story
alvinashcraft
21 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

TechBash 2026 Call for Speakers Ends Tomorrow

1 Share

The TechBash 2026 Call for Speakers is coming down to the wire, with submissions officially closing tomorrow, March 31 at 11:59pm Eastern. If you’ve been thinking about sharing your experience, insights, or hard‑won lessons with a passionate developer audience, this is your moment. TechBash has built a reputation for practical, community-driven content, and the conference is actively looking for speakers who want to educate, inspire, and spark meaningful conversations across the tech community.

TechBash 2026 will take place October 13–16, 2026 at the Kalahari Resorts & Convention Center in the Pocono Mountains of Pennsylvania, bringing together developers, engineers, and technology leaders from across the region and beyond. Speaking at TechBash is an opportunity to elevate your professional profile, contribute to a respected conference program, and connect with peers who value real-world solutions over sales pitches. Sessions of all experience levels are encouraged, and first-time speakers are welcome.

If you have a talk idea ready—or even just a strong outline—now is the time to submit it. Don’t miss your chance to be part of TechBash 2026 and help shape one of the region’s most anticipated developer conferences. Head over to TechBash.com to submit your session before the 11:59pm Eastern deadline tomorrow.



Read the whole story
alvinashcraft
28 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

AI: The Near Term

1 Share

As promised, I’ll be posting slides and commentary from my recent user-group presentation on AI (Boston Code Camp). One of my first slides talked about the near-term evolution of AI, defined as either 1-2 years or 6 months, depending on who you believe.

I divided the slide into two parts: good news and bad. The good news is the promise of enormously increased productivity, which may well lead to a higher standard of living across the board. Further, as AI progresses, we may see accelerated breakthroughs in many fields, most notably medicine and genetics.

The bad news is that along with these changes will almost certainly come massive displacement. As a society, we’ve seen this kind of displacement before. The advent of the tractor displaced well over 50% of farm workers, and ultimately mechanization displaced over 95% of agricultural labor!

The key difference, however, is that in the past technology displaced the least skilled workers; AI is set to affect many of the most educated and skilled. I’m not sure that society knows how to handle this. Reskilling has a poor performance history, and sending highly paid college-educated programmers back to two-year training programs in robotics does not seem auspicious.

In the very short term, AI presents some real challenges, not least is the environmental impact of massive energy-consuming data centers. Add to that the potential economic impact when the AI boom goes bust and there is plenty to worry about, but here is one more…

Right now we are learning to adjust to AI, but research continues on AGI (Artificial General Intelligence). The next step after that is Artificial Super Intelligence: when AI becomes meaningfully smarter than humans. No one knows quite what to expect when that happens, but I commend to you the book If Anyone Builds It, Everyone Dies by Eliezer Yudkowsky and Nate Soares. These are not crackpot writers — they are recognized experts in AI and their thesis is chilling.

In coming postings I will divide my attention between two aspects of AI:

  • Using AI in developing your application
  • Creating applications that incorporate AI

Along the way I will talk about AI in the .NET world (specifically the Azure workflow tools) and outside of .NET (time to brush up on Python).

Next up: Assisted Coding…

Read the whole story
alvinashcraft
40 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Vibe Coding Pong with Python and pygame

1 Share

Pong is one of the first computer games ever created, way back in 1972. If you have never heard of Pong, you can think of it as a kind of “tennis” game. There are two paddles, on each side of the screen. They move up and down. The goal is to bounce a ball between the two paddles. If you miss the ball, your opponent scores a point.

Atari created Pong and put it in arcades. The name of the game is derived from the game of ping-pong. Pong has been remade many times, with different features and gameplay elements added or removed.

Want to know more? Get the Book!

You will use Anthropic’s Claude AI to create this game in Python using the pygame package.

Let’s get started!

Creating the Game

Prompt: Please create the pong videogame using Python and pygame. Give the user a way to start a new game and keep score.

I’ll create a classic Pong game for you using Python and pygame. This will include two paddles, a ball, scoring, and the ability to start new games.

import pygame
import sys
import random

# Initialize Pygame
pygame.init()

# Constants
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
PADDLE_WIDTH = 15
PADDLE_HEIGHT = 90
BALL_SIZE = 15
PADDLE_SPEED = 7
BALL_SPEED_X = 6
BALL_SPEED_Y = 6

# Colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GRAY = (128, 128, 128)

class Paddle:
    def __init__(self, x, y):
        self.rect = pygame.Rect(
            x, y, PADDLE_WIDTH, PADDLE_HEIGHT)
        self.speed = PADDLE_SPEED
    
    def move_up(self):
        if self.rect.top > 0:
            self.rect.y -= self.speed
    
    def move_down(self):
        if self.rect.bottom < SCREEN_HEIGHT:
            self.rect.y += self.speed
    
    def draw(self, screen):
        pygame.draw.rect(screen, WHITE, self.rect)

class Ball:
    def __init__(self):
        self.rect = pygame.Rect(
            SCREEN_WIDTH // 2, 
            SCREEN_HEIGHT // 2, 
            BALL_SIZE,
            BALL_SIZE)
        self.reset_ball()
    
    def reset_ball(self):
        self.rect.center = (SCREEN_WIDTH // 2, 
            SCREEN_HEIGHT // 2)
        self.speed_x = BALL_SPEED_X * random.choice([-1, 1])
        self.speed_y = BALL_SPEED_Y * random.choice([-1, 1])
    
    def move(self):
        self.rect.x += self.speed_x
        self.rect.y += self.speed_y
        
        # Bounce off top and bottom walls
        if (self.rect.top <= 0 
            or self.rect.bottom >= SCREEN_HEIGHT):
            self.speed_y = -self.speed_y
    
    def draw(self, screen):
        pygame.draw.rect(screen, WHITE, self.rect)

class PongGame:
    def __init__(self):
        self.screen = pygame.display.set_mode(
            (SCREEN_WIDTH, SCREEN_HEIGHT))
        pygame.display.set_caption("Pong Game")
        self.clock = pygame.time.Clock()
        
        # Create game objects
        self.left_paddle = Paddle(
            30, SCREEN_HEIGHT // 2 - PADDLE_HEIGHT // 2)
        self.right_paddle = Paddle(
            SCREEN_WIDTH - 30 - PADDLE_WIDTH,
            SCREEN_HEIGHT // 2 - PADDLE_HEIGHT // 2)
        self.ball = Ball()
        
        # Scores
        self.left_score = 0
        self.right_score = 0
        self.font = pygame.font.Font(None, 74)
        self.small_font = pygame.font.Font(None, 36)
        
        # Game state
        self.game_state = "menu"  # "menu", "playing", "paused"
    
    def handle_collision(self):
        # Ball collision with paddles
        if self.ball.rect.colliderect(self.left_paddle.rect):
            # Only bounce if moving toward paddle
            if self.ball.speed_x < 0:  
                self.ball.speed_x = -self.ball.speed_x
                # Add some variation based on where ball hits paddle
                hit_pos = (self.ball.rect.centery - self.left_paddle.rect.centery
                          ) / (PADDLE_HEIGHT / 2)
                self.ball.speed_y += hit_pos * 2
        
        if self.ball.rect.colliderect(self.right_paddle.rect):
            # Only bounce if moving toward paddle
            if self.ball.speed_x > 0:  
                self.ball.speed_x = -self.ball.speed_x
                # Add some variation based on where ball hits paddle
                hit_pos = (self.ball.rect.centery - self.right_paddle.rect.centery
                          ) / (PADDLE_HEIGHT / 2)
                self.ball.speed_y += hit_pos * 2
        
        # Limit ball speed
        max_speed = 12
        if abs(self.ball.speed_y) > max_speed:
            self.ball.speed_y = max_speed if self.ball.speed_y > 0 else -max_speed
    
    def check_scoring(self):
        # Check if ball went off screen
        if self.ball.rect.left <= 0:
            self.right_score += 1
            self.ball.reset_ball()
        elif self.ball.rect.right >= SCREEN_WIDTH:
            self.left_score += 1
            self.ball.reset_ball()
    
    def handle_input(self):
        keys = pygame.key.get_pressed()
        
        if self.game_state == "playing":
            # Left paddle controls (W/S)
            if keys[pygame.K_w]:
                self.left_paddle.move_up()
            if keys[pygame.K_s]:
                self.left_paddle.move_down()
            
            # Right paddle controls (UP/DOWN arrows)
            if keys[pygame.K_UP]:
                self.right_paddle.move_up()
            if keys[pygame.K_DOWN]:
                self.right_paddle.move_down()
    
    def draw_menu(self):
        self.screen.fill(BLACK)
        
        title_text = self.font.render("PONG", True, WHITE)
        title_rect = title_text.get_rect(
            center=(SCREEN_WIDTH // 2, 150))
        self.screen.blit(title_text, title_rect)
        
        start_text = self.small_font.render(
            "Press SPACE to Start", True, WHITE)
        start_rect = start_text.get_rect(
            center=(SCREEN_WIDTH // 2, 250))
        self.screen.blit(start_text, start_rect)
        
        controls_text = [
            "Controls:",
            "Left Player: W (Up) / S (Down)",
            "Right Player: Arrow Keys",
            "Press R to restart during game",
            "Press ESC to return to menu"
        ]
        
        for i, text in enumerate(controls_text):
            rendered_text = self.small_font.render(
                text, True, GRAY if i == 0 else WHITE)
            text_rect = rendered_text.get_rect(
                center=(SCREEN_WIDTH // 2, 320 + i * 40))
            self.screen.blit(rendered_text, text_rect)
    
    def draw_game(self):
        self.screen.fill(BLACK)
        
        # Draw center line
        for i in range(0, SCREEN_HEIGHT, 20):
            if i % 40 == 0:
                pygame.draw.rect(
                    self.screen, 
                    WHITE, 
                    (SCREEN_WIDTH // 2 - 2, i, 4, 10))
        
        # Draw paddles and ball
        self.left_paddle.draw(self.screen)
        self.right_paddle.draw(self.screen)
        self.ball.draw(self.screen)
        
        # Draw scores
        left_score_text = self.font.render(
            str(self.left_score), True, WHITE)
        right_score_text = self.font.render(
            str(self.right_score), True, WHITE)
        
        self.screen.blit(left_score_text, (SCREEN_WIDTH // 4, 50))
        self.screen.blit(
            right_score_text, 
            (3 * SCREEN_WIDTH // 4 - right_score_text.get_width(),
             50))
        
        # Draw instructions
        instruction_text = self.small_font.render(
            "Press ESC for menu, R to restart", True, GRAY)
        instruction_rect = instruction_text.get_rect(
            center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT - 30))
        self.screen.blit(instruction_text, instruction_rect)
    
    def reset_game(self):
        self.left_score = 0
        self.right_score = 0
        self.ball.reset_ball()
        self.left_paddle.rect.y = (SCREEN_HEIGHT // 2 - 
            PADDLE_HEIGHT // 2)
        self.right_paddle.rect.y = (SCREEN_HEIGHT // 2 - 
            PADDLE_HEIGHT // 2)
    
    def run(self):
        running = True
        
        while running:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    running = False
                
                if event.type == pygame.KEYDOWN:
                    if (event.key == pygame.K_SPACE 
                        and self.game_state == "menu"):
                        self.game_state = "playing"
                        self.reset_game()
                    elif event.key == pygame.K_ESCAPE:
                        self.game_state = "menu"
                    elif (event.key == pygame.K_r 
                        and self.game_state == "playing"):
                        self.reset_game()
            
            if self.game_state == "menu":
                self.draw_menu()
            elif self.game_state == "playing":
                self.handle_input()
                self.ball.move()
                self.handle_collision()
                self.check_scoring()
                self.draw_game()
            
            pygame.display.flip()
            self.clock.tick(60)
        
        pygame.quit()
        sys.exit()

if __name__ == "__main__":
    game = PongGame()
    game.run()

I’ve created a complete Pong game in Python using pygame! Here are the key features:

Game Features:

  • Classic Pong gameplay with two paddles and a bouncing ball
  • Score tracking for both players
  • Menu system with game start option
  • Ability to restart games and return to menu

Controls:

  • Left Player: W (up) / S (down)
  • Right Player: Arrow keys (up/down)
  • SPACE: Start new game from menu
  • R: Restart current game
  • ESC: Return to main menu

Game Mechanics:

  • Ball bounces off top/bottom walls and paddles
  • Ball speed varies slightly based on where it hits the paddle
  • Scores increase when ball goes off either side
  • Ball resets to center after each score

To run the game:

  • Make sure you have pygame installed: pip install pygame
  • Save the code to a .py file (e.g., pong.py)
  • Run it with: python pong.py

The game includes a clean menu system, smooth 60 FPS gameplay, and responsive controls. The ball physics include some randomization to keep gameplay interesting, and the paddle collisions add a bit of strategy by allowing players to influence the ball’s trajectory based on where they hit it.

Prompt: Can you explain how the code works?

I’ll break down how the Pong game code works, explaining each major component and how they work together.

Code Structure Overview

 

The code is organized using object-oriented programming with three main classes:

  • Paddle – represents the player paddles
  • Ball – handles the bouncing ball
  • PongGame – manages the overall game logic and flow

1. Initialization and Constants

pygame.init()
# Constants define game dimensions and speeds
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
PADDLE_SPEED = 7

The game starts by initializing pygame and defining constants for screen size, object dimensions, and movement speeds. Using constants makes the code easier to modify and maintain.

2. The Paddle Class

class Paddle:
    def __init__(self, x, y):
        self.rect = pygame.Rect(x, y, PADDLE_WIDTH, PADDLE_HEIGHT)

Each paddle is represented as a pygame.Rect object, which provides built-in collision detection and positioning. The paddle has methods to:

  • move_up() and move_down() – handle movement with boundary checking
  • draw() – renders the paddle as a white rectangle

The boundary checking ensures paddles can’t move off-screen:

if self.rect.top > 0:  # Don't go above screen
if self.rect.bottom < SCREEN_HEIGHT:  # Don't go below screen

3. The Ball Class

class Ball:
    def reset_ball(self):
        self.speed_x = BALL_SPEED_X * random.choice([-1, 1])
        self.speed_y = BALL_SPEED_Y * random.choice([-1, 1])

The ball maintains its position and velocity. Key features:

  • reset_ball() – centers the ball and gives it a random direction
  • move() – updates position and handles wall bouncing
  • Wall collision detection flips the Y velocity: self.speed_y = -self.speed_y

4. Main Game Class Structure

 

The PongGame class manages everything:

Game States

self.game_state = "menu"  # "menu", "playing", "paused"

The game uses states to control what’s displayed and what input is accepted.

Game Loop

def run(self):
    while running:
        # Handle events (keyboard, quit)
        # Update game logic based on current state
        # Draw everything
        # Control frame rate (60 FPS)

5. Collision Detection

 

The most complex part handles ball-paddle collisions:

def handle_collision(self):
    if self.ball.rect.colliderect(self.left_paddle.rect):
        # Only bounce if moving toward paddle
        if self.ball.speed_x < 0:  
            self.ball.speed_x = -self.ball.speed_x

Key points:

  • Uses pygame’s built-in colliderect() for collision detection
  • Checks ball direction to prevent multiple bounces
  • Adds spin based on where the ball hits the paddle:
hit_pos = (self.ball.rect.centery - 
           self.left_paddle.rect.centery
           ) / (PADDLE_HEIGHT / 2)
self.ball.speed_y += hit_pos * 2

6. Input Handling

def handle_input(self):
    keys = pygame.key.get_pressed()
    if keys[pygame.K_w]:
        self.left_paddle.move_up()

The game checks which keys are currently pressed each frame, allowing for smooth continuous movement. Different keys are handled based on the game state.

7. Scoring System

def check_scoring(self):
    if self.ball.rect.left <= 0:  # Ball went off left side
        self.right_score += 1
        self.ball.reset_ball()

Scoring is checked every frame by seeing if the ball has moved past the screen edges.

8. Rendering System

The game uses different drawing functions for different states:

  • draw_menu() – shows title and instructions
  • draw_game() – renders paddles, ball, scores, and game elements

The center dashed line is drawn using a loop:

for i in range(0, SCREEN_HEIGHT, 20):
    if i % 40 == 0:  # Only draw every other dash
        pygame.draw.rect(
            self.screen, 
            WHITE, 
            (SCREEN_WIDTH // 2 - 2, i, 4, 10))

9. Game Flow

  1. Initialization: Create paddles, ball, set up pygame
  2. Main Loop:
  • Process input events
  • Update game logic (if playing)
  • Draw current state
  • Maintain 60 FPS with clock.tick(60)
  1. State Management: Switch between menu and gameplay based on user input

Key Programming Concepts Used

  • Object-Oriented Design: Separate classes for different game elements
  • Event-Driven Programming: Responding to keyboard and quit events
  • Game Loop Pattern: Continuous update-draw cycle
  • State Management: Different behaviors based on current game state
  • Collision Detection: Using pygame’s rectangle collision methods
  • Vector Math: Ball movement with X/Y velocity components

The code is structured to be easily extensible – you could add features like AI opponents, power-ups, or different game modes by building on this foundation.

Running Pong

Now that you have the code and understand how to use it, you are ready to run the code. You can run your code in your Python IDE or on the command line like this:

python pong.py

When you first launch your game, you will see the following welcome screen:

Pong main screen

If you press the SPACE key, you will see the actual game, which will look something like this:

Pong game play

Grab a friend or play against yourself. The game works pretty well, although playing solo can be rather challenging.

Wrapping Up

Pong is a fun little game. Much like ping-pong or table tennis, the game is designed to be played with someone else. Technically, you could also create a computer opponent, but you usually play Pong between two people instead.

You should play the game with a friend or family member. You can also study the code to discover how it works. Then, when you are ready, you can start improving the game.

Get the Book

This article is from my latest Python book, Vibe Coding Video Games with Python.

You can get Vibe Coding Video Games with Python at the following websites:

The post Vibe Coding Pong with Python and pygame appeared first on Mouse Vs Python.

Read the whole story
alvinashcraft
56 seconds ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories