Taking the Squash Pong game and using data science to make it AI powered! Dr Isaac Triguero uses regression & nearest neighbour.

Playlist of all four videos:

Thorsten & Isaac’s Python programming book:

This video was filmed by Sean Riley and Isaac Triguero and edited by Sean Riley.

Computer Science at the University of Nottingham:

Computerphile is a sister project to Brady Haran’s Numberphile. More at

Nguồn: https://rantbit.com

Xem thêm bài viết khác: https://rantbit.com/game/



47 thoughts on “Pong, Python & PyGame 11 – Computerphile

  1. I have a question, the value I get from clf.predict() is a (1×1) array, which caused an error as it needs a number for new y value. What I did was convert the (1×1) array values into number values. It seems to work flawlessly now, but is this how I'm supposed to do it?

  2. This is. So. Amazing !
    Ty for this amazing series !
    I love it !
    Will implement this asap ❤
    I'm hyped…

  3. I typed the code parallel to all II videos. I only had basic knowledge of Python, but some experience with Java (which is not always helpful…).
    I went through all the Anaconda3 installation progress several times, because it wouldn't work at first on my mac. Then after several tries, it eventually worked and I even got Jupyter lab and notebook running. I typed in the code, again, I struggled a bit to get the path to my file correct, but it eventually worked. Now when I continued with the video, I realized "Hey, he only used the program I've spent days on for installing to make a demonstration…" 😂
    Back for the original pong-squash program I did the installation of scikit and pandas which worked like a charm with pip.
    I was able to fix several bugs with my code, which was mostly due to different notation for variables (you named the objects ballplay and paddleplay in the first video but later changed the names to ball and paddle). Finally, shouldMove somehow turned out to be an array in my program and I also had to round the value stored there to an integer value using int(round(shouldMove[0])).
    And then… it worked perfectly! (So proud of myself 🤓)
    Thank you so much for that wonderful example! I really learned a lot on programming in Python from it.

  4. What source would you recommendation to start learning about data structures and algorithms in Python?

  5. 7:00 – I recently found out in Python 3.6, they introduced something called "f-string" which makes formatting string with variables so much easier compared to .format.

  6. Nice! I just got done making the classical games Tetris and Brick Breaker in java on my channel. Great games!

  7. @Computerphile Please do more of these. This video series was fantastic. Would love to see more actual code or live coding videos like these and not just the usual theory.

  8. Great ! Btw, I can't beat my AI, Damn!

    One small annoying thing I came across was that some lines in the CSV file have a missing field(s) or to many fields. Had to correct that by hand…

  9. 7:11 prepared statements are a particular thing from python? That would be new to me, who has programmed with them long before python even existed… XD

  10. It's unfortunate you guys skipped over all the really interesting parts of the original implementation. Collision detection and how to implement the angle of reflection so that the game is actually fun to play. For instance, the game is often implemented so that the angle of the bounce is altered depending on where the ball hits the paddle. Sometimes there's even a change in ball velocity depending on paddle velocity. Just saying, there's a lot of interesting game design principles that could have been explored here.

  11. Haven't fully watched it yet, but for anyone that got here and wants to learn a bit more: I've made a year ago a pygame pong that communicates through LAN. Just search for /tuliosj/pong on GitHub.

  12. 7:00 why no <code> print (f"{ball.x},{ball.y},{ball.vx},{ball.vy},{paddle.y}", file=sample) </code> ? Is it just a Python2 habit or am I missing something? Excuse me if this question is not smart, I am new to Python.

  13. it’s an answer to a test! Where’s all the cheating students at? Lol Sad there’s no online code but great series! I appreciate the work you guys put in.

Leave a Reply

Your email address will not be published. Required fields are marked *