Michael Schrandt
Michael Schrandt
  • Видео 10
  • Просмотров 38 549
Cracking 2048 in Python with Expectiminimax
Code used in this lesson: github.com/mschrandt/2048
Expectiminimax: en.wikipedia.org/wiki/Expectiminimax
Heuristic ideas: cs229.stanford.edu/proj2016/report/NieHouAn-AIPlays2048-report.pdf
Music and sound effects:
RUclips Audio Library
www.sfxbuzz.com/download/9-cartoon-sound-effects/134-record-scratch-sound-effect
0:00 Intro
0:45 Building the Model
4:09 Pygame component
5:56 Expectiminimax overview
10:21 Implementing expectiminimax
12:24 Demo
15:25 Fun scenarios
18:58 Outro
Просмотров: 5 314

Видео

Solving the 15 Puzzle in Python with IDA*
Просмотров 8 тыс.2 года назад
Code used in this lesson: github.com/mschrandt/NPuzzle N Puzzle Parity: en.wikipedia.org/wiki/15_puzzle#Solvability IDA* Algorithm: en.wikipedia.org/wiki/Iterative_deepening_A* Felner, A., Korf, R. E., & Hanan, S. (2004). Additive Pattern Database Heuristics. Journal of Artificial Intelligence Research, 22, pp. 279-318 www.aaai.org/Papers/JAIR/Vol22/JAIR-2209.pdf 0:00 Intro 0:41 Puzzle model 4:...
Solving Wordle with Python
Просмотров 2,8 тыс.2 года назад
Play Wordle www.powerlanguage.co.uk/wordle/ Code used in this lesson: github.com/mschrandt/Wordle 0:00 Intro to Wordle 1:06 Principles 3:14 Whiteboarding 6:24 Base algorithm 10:31 Implementing naïve solution 18:00 Automation 24:57 Improvement #1 - Letter frequency 30:32 Improvement #2 - Don't filter pick list 35:10 Improvement #3 - Use game's dictionary 40:05 Demo 40:56 Recap
David Bowie Life on Mars? Piano Cover
Просмотров 1154 года назад
Piano cover of David Bowie's Life on Mars. Sheet music: www.pianoshelf.com/sheetmusic/2458/david-bowie life-on-mars
Clair de Lune
Просмотров 1689 лет назад
This is the third movement of Debussy's Suite bergamasque (1890). It was inspired by Paul Verlaine's poem (1869), also called Clair de Lune. Here's an English translation of the poem: Your soul is a chosen landscape Where charming masqueraders and bergamaskers go Playing the lute and dancing and almost Sad beneath their fanciful disguises. All sing in a minor key Of victorious love and the oppo...
My Map Editor - C# / WPF
Просмотров 4,6 тыс.11 лет назад
A tile based map editor demonstration. Here is a link to the tilesheet demonstrated in the video: telles0808.deviantart.com/art/RPG-Maker-VX-RTP-Tileset-159218223
C++/SFML Game Demo
Просмотров 2,5 тыс.12 лет назад
Here's some low quality footage of a game that I've been working on. It's a 2d platformer where the player is able to shoot a variety of bullets, each of which interact differently with the environment. The art is temporary.
Tetris AI - C++/SDL
Просмотров 2,1 тыс.12 лет назад
A tetris clone written in C and SDL played by AI (also written in C ).
A* Pathfinding Example - Pygame
Просмотров 11 тыс.13 лет назад
A simple implementation of the A* pathfinding algorithm written in python. The engine is a very simple platformer. The object of the game is to reach the yellow tile in as little time as possible, but my job was to make the computer find the shortest path. The first part is controlled by me to show how the game works, but everything else is AI controlled. When the solve command is executed, the...
Snake - C++ & Allegro
Просмотров 2 тыс.14 лет назад
A snake clone written in C and Allegro.

Комментарии

  • @aziendaromanflex3358
    @aziendaromanflex3358 5 месяцев назад

    Good morning Michael, I apologize for my poor English, I am Italian. I wanted to ask you if by chance the Python code could be adapted to VBA (I know that one unfortunately) or if it is possible to have a file with the Patterns database to then be read by VBA. Truly an excellent job. Thanks for any help you want to give me. Marco - Rome - Italy

  • @sonhoang7762
    @sonhoang7762 6 месяцев назад

    can you use java with A*

    • @awful999
      @awful999 3 месяца назад

      yes, the programming language is simply a means to an end

  • @simonv3548
    @simonv3548 Год назад

    very nice video! thanks.

  • @KaiMK
    @KaiMK Год назад

    Thank you so much!

  • @JingtongYang
    @JingtongYang Год назад

    Super clear and understandable! Thanks so much

  • @mouadmhannee5267
    @mouadmhannee5267 Год назад

    Hey, could i have a look at a code so i can try and comprehend it myself or could you refer me to the resources you have used to learn this?

  • @Jakub1989YTb
    @Jakub1989YTb Год назад

    Perfect! Pleasure to listen to.

  • @MONROTE
    @MONROTE 2 года назад

    Hello, Michael Schrandt, great videos, I love them! I'm writing to ask if there is any chance you could help me with my puzzle game solver. I've got a pyramid of balls which you have to sort in a right order in minimum steps. I'm trying to use IDA* algorithm, but can't come up with a nice heuristics and stuck on the problem for 2 months. I was also trying to follow your 8-puzzle video to build up a pattern database, but don't really understand the logic of splitting my pyramid. If you could help, I would be very grateful. Answer this comment so I could share more details in case you can help. Best wishes, Alex

  • @christinemerand868
    @christinemerand868 2 года назад

    Excellent

  • @lukollolak6219
    @lukollolak6219 2 года назад

    Amazing video, I can't thank you enough, you will have saved my semesteral project. Only you have made a small mistake in 21:44 , 6 and 4 are not in the same row. Omg I was coding it simultaneously with you and I couldn't figure out why my code doesn't work lol.

    • @mschrandt
      @mschrandt 2 года назад

      Nice catch ;) glad this was helpful!

  • @firstnamelastname-oy7es
    @firstnamelastname-oy7es 2 года назад

    This is like noita

  • @kir6052
    @kir6052 2 года назад

    cool music

  • @mobslayer2023
    @mobslayer2023 2 года назад

    Thanks man you got me 3 points EC

  • @pobttt8925
    @pobttt8925 2 года назад

    great!

  • @giantnoah
    @giantnoah 2 года назад

    How does it handle maps that require you to go right then left to get higher?

  • @gatetm
    @gatetm 2 года назад

    tas moment

  • @nickheyer
    @nickheyer 2 года назад

    Does the algo take the gravity physics into account?! How is it implemented?

    • @mschrandt
      @mschrandt 2 года назад

      Yes, it does in fact take physics into account! At each iteration of the search, we make a copy of the game state and "simulate" what would happen at each button press (up, down, left, right, jump, do nothing) and that becomes a child node of the graph search. I think I'll make a video on this algorithm with physics involved next ;)

    • @SanyaBane
      @SanyaBane 2 года назад

      @@mschrandt thanks

    • @CarZyer
      @CarZyer 4 месяца назад

      hi

  • @Moviesntvz
    @Moviesntvz 2 года назад

    Hey trying to make a simple version to wordle having some issues with the code ..could u take a look for me plz

  • @temptedtrevor8498
    @temptedtrevor8498 2 года назад

    Amazing! This is exactly what I was looking for.

  • @nexxel
    @nexxel 2 года назад

    Great video, thank you!

  • @rasberryjuce
    @rasberryjuce 2 года назад

    I, too, am in awe of both your "product" and - even more - your sharing your "thought processes" in developing it.... However, it seems almost "sloppy" for you NOT to have read about ["researched" ?] and initially coded the "1250 or so COMMON WORDS" that turned the game into the big hit that it quickly became. Towards the end, when your algorithm suggested trying the word CONTG, it became clear that you had put "the CART in front of the HORSE." As I say, I'm overwhelmingly positive about this video, but there IS a lesson to be learned from what I've written. (It's as if someone were trying to develop a drug to cure this or that ... just by trying a thousand different existing drugs as step #1. It's best to let "what's known" color what one tries, and it's even better to focus on "WHAT DO WE/SHOULD WE KNOW?" before starting to code.)

    • @mschrandt
      @mschrandt 2 года назад

      Thanks for the feedback! I definitely don't have an optimal strategy here (or a perfect thought process ;) For your example, I actually purposely coded this to pick uncommon words with the goal of filtering the answer space as much as possible. There are two lists in my program: possible answers which are common words, and a guess list which contains obscure words that are allowed to be entered. Hope that makes sense.

  • @iankelley9302
    @iankelley9302 2 года назад

    Amazing video! Nice job on the mic quality too, it sounds much better and more professional.

  • @AshishBeck
    @AshishBeck 2 года назад

    Hey great stuff. May I have the permission to use this to implement a solver for my n puzzle game I made using Flutter? I will give you proper credit of course

    • @mschrandt
      @mschrandt 2 года назад

      Thanks for the feedback, feel free to use it however you want!

    • @AshishBeck
      @AshishBeck 2 года назад

      @@mschrandt Thank you. Full disclosure: I am building it for a coding competition

  • @KillBill1299
    @KillBill1299 2 года назад

    can i use PyCharm to run this?

    • @mschrandt
      @mschrandt 2 года назад

      I haven't tried pycharm, but it should work just fine.

  • @ntskl
    @ntskl 2 года назад

    Great stuff

  • @iankelley9302
    @iankelley9302 2 года назад

    This is an amazing video! You should consider getting a better mic though, your code and explanations are so great, but the audio quality is very poor.

    • @mschrandt
      @mschrandt 2 года назад

      Thank you for the feedback! I bought a new mic and am in the middle of recording the next one ;)

  • @alamjim6117
    @alamjim6117 2 года назад

    So intuitive... Thank you very much! <3 Watched the entire video and it was so well explained.

  • @dot32
    @dot32 3 года назад

    odd music but that looks really neat!

  • @MakeMusic88
    @MakeMusic88 4 года назад

    Beautiful song & beautiful piano playing there ! :-) Thumps up, I've really enjoyed your music ! I play also the piano :-) Listen to my music if you want :)

  • @jacobfoley4362
    @jacobfoley4362 6 лет назад

    I know this a couple centuries late, but do you have the source code for this project?

  • @black_squall
    @black_squall 7 лет назад

    Debussy?

  • @maxbaker3290
    @maxbaker3290 9 лет назад

    nice

  • @jabeoogie
    @jabeoogie 9 лет назад

    Best version I've ever heard! Nice

  • @ramiBudemaris
    @ramiBudemaris 11 лет назад

    so how did you build the heuristics function ?? just wondering

    • @mschrandt
      @mschrandt 11 лет назад

      I'd have to dig up the code again, but I'm pretty sure the functions is just rise + run. Keep in mind, it's a weighted heuristic. This makes the resulting path slightly less optimal, but much quicker to generate.

  • @DjSwiti
    @DjSwiti 11 лет назад

    Thank you for your answer, I will use OpenGL because another guy told me that was better. Anyway, Well done for your fantastic AI ! May I have the binary please? (for linux ?)

  • @mschrandt
    @mschrandt 11 лет назад

    Drawing is always going to be the bottleneck. A common strategy is to only draw every x frames, or move each piece more than one unit per frame. Are you attempting to limit the amount of frames per second? If you do not limit the FPS, the program will consume as much CPU power as it can (which is desirable during benchmarks, but not during regular gameplay). If you really want speed in graphics, consider using OpenGL. It's not easy, but it will be fast.

  • @DjSwiti
    @DjSwiti 11 лет назад

    I'm using SDL too, in but in C language. It is extremely heavy ! Drawing the board consume between 20% and 40% for each processor heart. (i have an i7). Do you have any clues ? SDL_BlitSurface is the reason why it consumes...

  • @mschrandt
    @mschrandt 11 лет назад

    Yeah, exactly. The goal is to throw any map at it, and the block should find a path that avoids obstacles.

  • @mschrandt
    @mschrandt 11 лет назад

    If I disable the graphics, it gets a HUGE speed boost. Drawing the board is the most cpu intensive part.

  • @DjSwiti
    @DjSwiti 11 лет назад

    Freakin nice and seems to be powerfull ! Is it proc consuming ?

  • @GorillaTacticsGames
    @GorillaTacticsGames 11 лет назад

    Do you test the path to make sure the block can avoid obstacles?

  • @MrBober66
    @MrBober66 11 лет назад

    Haha good ! :D

  • @ProgrammerInProgress
    @ProgrammerInProgress 12 лет назад

    A neat little editor!

  • @mschrandt
    @mschrandt 12 лет назад

    Yes you could, but since it's so calculation intensive, you're better off scripting cutscenes so that the paths is precomputed.

  • @Resulli
    @Resulli 12 лет назад

    Could you potentially use something like this to create a cutscene? I've yet to play with pygame myself so I don't know much about the structure.

  • @mschrandt
    @mschrandt 12 лет назад

    Thanks! At the moment, the height and width are listed followed by 4 grids of numbers (one grid per layer). The number recorded is the index that the tile is located in the original tilesheet.

  • @WillTaplin
    @WillTaplin 12 лет назад

    Nice! It looks like it's simple to use. What does the map format look like?

  • @mschrandt
    @mschrandt 12 лет назад

    Well, no matter what parameters exist in the system, the same steps would be followed: A path is generated based on the "laws of physics" (only gravity is present in this simulation). Once this path is generated, it is displayed so we can see it, and then the block attempts to follow the path. I'm not sure if it is clear, but the block is NOT stuck to this line, it is using the game controls (move and jump) to stick as close to the line as possible.

  • @ip0dout
    @ip0dout 12 лет назад

    It looks like you just created a path for the box to move, and it just follows it... :/ I thought that you would give certain parameters, such as gravity, air resistance, momentum, and speed, to find the closest possible route to the finish line.

  • @mschrandt
    @mschrandt 12 лет назад

    Books, forums, school, and a lot of practice :)