Python Simulation Tutorial - Conway's Game of Life
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
I was waiting for you to make Conway's game of life and finally, here it is. Great video! :D
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.
What a concept!
I had been breaking my head to understand the concept & this happens finally. Thank you Tim
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.
fantastic, just the thing i was looking for: python implementation of Conway's Life with clickable nodes
thank you for the tutorial works perfectly fine !
i really like these kind of video please make more of these video i am looking forward for that thank you once again....👏🏻🙌🏻👏🏻
Outstanding Tim, loved this one.
Thank you!
amazing video keep up the good work
this was great, cheers
Very interesting - great code as usual. Thanks !
Glad you liked it!
Didn't realise set() data structure and methods were so useful.
best coder vid's on youtube
I did this in processing....was fun
Hii, really useful video... like always :)
great video 👍
Thanks bro, otherwise I ran into a bunch of bugs when developing the game "life" on my game engine.
Thanks Tim
No problem :)
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:)
can you make a tutorial on reflex or pynecone
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?
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
How Can i make simulation like Project jdm and math Floyd can you make a video or tell me where to start
I had to recreate this in Java for school. Sucked. lol
same lol what school u go to?
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?
Does anyone please have a version of this code with ezgraphics?
Hey Tim, can help help the community to create a product web app
Insaine!! how do you learn programming like this?? 🤯
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.
first comment i think
😆😅
Why pygame instead of pygame-ce?
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.
@@SOLDAT_MENDES is this chat gpt
Hello
Hey!
I was tried your all projects of python nd it really helped me very much❤️
Please stop saying actually so much.
I think ur the only one bothered