Beating Minesweeper: What creating a bot with global high-scores can teach you.

Samarth Hattangady (~samhattangady)


Description:

Computers and games have always shared a very special relationship. Video games have been pushing the limits of software and hardware more than any other industry. Many landmark moments in the history of computing have come from a computer beating a human at a game, from Deep Blue beating Kasparov in 1997, to AlphaGo beating Lee Sedol in 2016. Introducing computers to games is pushing the limits of AI as we know it, and game making is one of the most popular ways to introduce new people to programming. Following in the same tradition, we will use a game to teach various aspects of Python and Computer Science.

Minesweeper is one of the most popular computer games, entirely because of its inclusion in the standard Windows install. As a game, its rules are fairly straightforward, which makes it an excellent exercise in learning automation. However, the game is complex enough that it can teach us a variety of advanced CS topics and give us the satisfaction of actually accomplishing something. An added bonus is that high scores are calculated based on the time taken to solve, so there is a fun exercise in optimisation as well.

As a part of this talk I will discuss how creating this bot taught me about real-world applications of the following topics:

  1. GUI Automation
  2. Computer Vision and Template Matching
  3. Graph Search: Breadth first vs Depth first
  4. pyautogui module
  5. Elements of code optimisation
  6. P vs NP

I gave a lightning talk in PyCon India 2018 on the same topic, and given the reception of that talk, I think there is a lot of value that can be shared via this talk, as well as an overall enjoyable experience. In this talk, I will be detailing how I went about solving the problem. What were the pitfalls I faced, and how I could apply the lessons I learnt to my other projects. Additionally I will also discuss other places where the same kind of

Prerequisites:

  • A basic understanding of Python

Content URLs:

My lightning talk on the same subject: https://www.youtube.com/watch?v=xDKaxTliecA

Github link to repo: https://github.com/samhattangady/nimbus2018

Youtube video of bot in action: https://www.youtube.com/watch?v=JdOu3rMDLqg

Speaker Info:

My name is Samarth Hattangady, and I write code.

After graduating from my Mechanical Engineering degree, I realised that I didn't actually like Mechanical Engineering, so I went ahead and taught myself how to program. Since then I have worked in a couple of startups building backends for ML and processing drone data.

I have been a developer at a Banagalore based start-up called Skylark Drones. As one of the few developers in the team, I got to don many hats across domains. I created POC web applications, worked on internal tools dealing with GIS, automated processes involving large volumes of data flow and wrote code that ran on the drone itself. And that was just a typical week.

I have been working in Python for over 3 years, and love it. The Zen of Python is essentially my life philosophy and I enjoy the simplicity and expressiveness that the language grants. I also like to build random toy programs that do things from solving Minesweeper to day-trading in cryptocurrency markets. Currently, I am working on making a mobile game.

My interests include: Biryani, Ultimate Frisbee and Considering bugs as features.

Speaker Links:

Github: https://github.com/samhattangady

Id: 1254
Section: Others
Type: Talks
Target Audience: Beginner
Last Updated: