Python Simulation Tutorial - Conway's Game of Life

Sdílet
Vložit
  • čas přidán 10. 06. 2024
  • Today, I am going to show you how to create the famous simulation known as "Conway's Game of Life", a cellular automation devised by John Horton Conway in 1970. We are going to build it in Python using Pygame in less than 1 hour!
    Get started with Taipy's open-source library and build entire applications quickly and easily with python: github.com/Avaiga/taipy
    🎓 Premium Courses
    🏢 CourseCareers coursecareers.com/a/techwithtim
    🔗 BlockchainExpert algoexpert.io/blockchain (use code “tim”)
    💻 ProgrammingExpert programmingexpert.io/tim (use code “tim”)
    🎓 Free Courses
    📚 Introduction To Software Development coursecareers.com/a/techwithtim
    🎞 Video Resources
    Code Download: github.com/techwithtim/Conway...
    Install Pygame (Mac): • How to Install Pygame ...
    Install Pygame (Windows): • How to Install Pygame ...
    ⏳ Timestamps
    00:00 | Overview
    01:34 | Taipy
    02:37 | Rules Visuals
    03:34 | Pygame Install
    04:10 | Constants and Setup
    06:50 | Writing the Main Loop
    09:36 | Drawing The Grid
    19:26 | Adding Cells
    22:12 | Handling Other Keypresses
    26:59 | Updating The Grid
    🔗 Socials
    📸 Instagram / tech_with_tim
    🐦 Twitter / techwithtimm
    💬 Discord / discord
    🤝 LinkedIn / tim-ruscica-82631b179
    🌐 Website techwithtim.net
    💾 GitHub github.com/techwithtim
    Support
    👕 Merch teespring.com/stores/tech-wit...
    💵 Donations www.paypal.com/donate?hosted_...
    🙏 Patreon / techwithtim
    🔖 Tags
    -Tech with Tim
    - Python Programing
    - Simulation Tutorial
    Hashtags
    #python
    #techwithtim
    #pythontutorial

Komentáře • 44

  • @StreakyFly
    @StreakyFly Před 8 měsíci

    I was waiting for you to make Conway's game of life and finally, here it is. Great video! :D

  • @bp-ob8ic
    @bp-ob8ic Před 8 měsíci +2

    Conway's Game of Life has always fascinated me.
    Gonna work through this in the morning. Thanks for this tutorial.
    I was able to follow the logic, and it mostly matched the pseudo code I had blocked out. Now I just have to learn more pygame.

  • @user-ts9ks8in2n
    @user-ts9ks8in2n Před 8 měsíci +5

    What a concept!
    I had been breaking my head to understand the concept & this happens finally. Thank you Tim

  • @NicolasFleury-ww5ut
    @NicolasFleury-ww5ut Před měsícem

    It is working perfectly well! Thank you Tim.
    However, please note that on line 21 of the code, you should invert GRID_WIDTH and GRID_HEIGHT for correct random position generation, especially for different screen width and height.

  • @void_presence
    @void_presence Před 5 měsíci +1

    fantastic, just the thing i was looking for: python implementation of Conway's Life with clickable nodes

  • @eNit0x
    @eNit0x Před měsícem

    thank you for the tutorial works perfectly fine !

  • @westudy9180
    @westudy9180 Před 8 měsíci +1

    i really like these kind of video please make more of these video i am looking forward for that thank you once again....👏🏻🙌🏻👏🏻

  • @vizionthing
    @vizionthing Před 8 měsíci

    Outstanding Tim, loved this one.

  • @ashirwadsingh6926
    @ashirwadsingh6926 Před 8 měsíci

    amazing video keep up the good work

  • @plinketharry7469
    @plinketharry7469 Před 8 měsíci

    this was great, cheers

  • @paulthomas1052
    @paulthomas1052 Před 8 měsíci

    Very interesting - great code as usual. Thanks !

  • @BsktImp
    @BsktImp Před 8 měsíci

    Didn't realise set() data structure and methods were so useful.

  • @timeWaster76
    @timeWaster76 Před 3 měsíci

    best coder vid's on youtube

  • @beforeikillyou7430
    @beforeikillyou7430 Před 8 měsíci

    I did this in processing....was fun

  • @pathapativarshitha1780
    @pathapativarshitha1780 Před 8 měsíci

    Hii, really useful video... like always :)

  • @gamerfisch5117
    @gamerfisch5117 Před 8 měsíci

    great video 👍

  • @programm_mister9692
    @programm_mister9692 Před 5 měsíci +1

    Thanks bro, otherwise I ran into a bunch of bugs when developing the game "life" on my game engine.

  • @richardsifeanyi6766
    @richardsifeanyi6766 Před 8 měsíci

    Thanks Tim

  • @MrMysterious31
    @MrMysterious31 Před 8 měsíci

    Hi tim, I want to simulate how an object of certain pounds would react on the different planets with different gravity.. kindly make a video if possible.. regards:)

  • @miichanshi
    @miichanshi Před 8 měsíci

    can you make a tutorial on reflex or pynecone

  • @Digital_Anime_Creator0709
    @Digital_Anime_Creator0709 Před 8 měsíci

    heloo sir can u create a digitmatch that can predict the last number randomly for example entry spot 12345 the last is 5 then the last exit result lexit spot
    is 5 also can u make it this sir?

  • @17crescent
    @17crescent Před 8 měsíci +1

    Great video. Slight correction as 39+1 can never be > 40 in your example grid. Plus added a wrap-around:
    def get_neighbors(pos):
    x, y = pos
    neighbors = []
    for dx in [-1, 0, 1]:
    if x + dx < 0:
    x += GRID_WIDTH
    elif x + dx == GRID_WIDTH:
    x -= GRID_WIDTH
    for dy in [-1, 0, 1]:
    if y + dy < 0:
    y += GRID_HEIGHT
    elif y + dy == GRID_HEIGHT:
    y -= GRID_HEIGHT
    if dx == 0 and dy == 0:
    continue
    neighbors.append((x + dx, y + dy))
    return neighbors

  • @decreezeogaming3600
    @decreezeogaming3600 Před 5 měsíci

    How Can i make simulation like Project jdm and math Floyd can you make a video or tell me where to start

  • @foqsi_
    @foqsi_ Před 8 měsíci +8

    I had to recreate this in Java for school. Sucked. lol

  • @thiccbum3942
    @thiccbum3942 Před 6 měsíci

    Hey. I followed the tutorial and everything works until I try to run the simulation. I get the error "not enough values to unpack (expected 2, got 1)" at line 58 (x, y = pos in the get_neighbors function)
    Any idea why this happens and how to fix it?

  • @jerryedept2022
    @jerryedept2022 Před 4 měsíci +1

    Does anyone please have a version of this code with ezgraphics?

  • @meim6028
    @meim6028 Před 8 měsíci

    Hey Tim, can help help the community to create a product web app

  • @Pramix
    @Pramix Před 8 měsíci

    Insaine!! how do you learn programming like this?? 🤯

    • @SOLDAT_MENDES
      @SOLDAT_MENDES Před 8 měsíci +2

      he practice, practice, practice. Programming is a skill that improves with hands-on experience. Start with the basics, like learning a programming language, understanding concepts, and solving small coding problems. Build projects, join coding communities, and never stop learning. It takes time and effort, but it's worth it.

  • @mehtabsinghgiran6531
    @mehtabsinghgiran6531 Před 8 měsíci

    first comment i think
    😆😅

  • @jeffreyepiscopo
    @jeffreyepiscopo Před 8 měsíci

    Why pygame instead of pygame-ce?

    • @SOLDAT_MENDES
      @SOLDAT_MENDES Před 8 měsíci

      pygame-ce is a community-driven fork of pygame that aims to continue development and address some of the issues in the original pygame. While pygame-ce offers some improvements, the choice between pygame and pygame-ce ultimately depends on your specific needs and preferences. Both libraries can be used to create games and multimedia applications in Python.

    • @jeffreyepiscopo
      @jeffreyepiscopo Před 8 měsíci +2

      @@SOLDAT_MENDES is this chat gpt

  • @nakulgaming2537
    @nakulgaming2537 Před 8 měsíci +1

    Hello

    • @TechWithTim
      @TechWithTim  Před 8 měsíci +2

      Hey!

    • @nakulgaming2537
      @nakulgaming2537 Před 8 měsíci +1

      I was tried your all projects of python nd it really helped me very much❤️

  • @no99mnecfw
    @no99mnecfw Před 8 měsíci

    Please stop saying actually so much.