- Видео 10
- Просмотров 38 549
Michael Schrandt
Добавлен 2 янв 2008
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
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...
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
can you use java with A*
yes, the programming language is simply a means to an end
very nice video! thanks.
Thank you so much!
Super clear and understandable! Thanks so much
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?
Perfect! Pleasure to listen to.
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
Excellent
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.
Nice catch ;) glad this was helpful!
This is like noita
cool music
Thanks man you got me 3 points EC
great!
How does it handle maps that require you to go right then left to get higher?
tas moment
Does the algo take the gravity physics into account?! How is it implemented?
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 ;)
@@mschrandt thanks
hi
Hey trying to make a simple version to wordle having some issues with the code ..could u take a look for me plz
Amazing! This is exactly what I was looking for.
Great video, thank you!
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.)
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.
Amazing video! Nice job on the mic quality too, it sounds much better and more professional.
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
Thanks for the feedback, feel free to use it however you want!
@@mschrandt Thank you. Full disclosure: I am building it for a coding competition
can i use PyCharm to run this?
I haven't tried pycharm, but it should work just fine.
Great stuff
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.
Thank you for the feedback! I bought a new mic and am in the middle of recording the next one ;)
So intuitive... Thank you very much! <3 Watched the entire video and it was so well explained.
odd music but that looks really neat!
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 :)
I know this a couple centuries late, but do you have the source code for this project?
Debussy?
nice
Best version I've ever heard! Nice
so how did you build the heuristics function ?? just wondering
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.
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 ?)
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.
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...
Yeah, exactly. The goal is to throw any map at it, and the block should find a path that avoids obstacles.
If I disable the graphics, it gets a HUGE speed boost. Drawing the board is the most cpu intensive part.
Freakin nice and seems to be powerfull ! Is it proc consuming ?
Do you test the path to make sure the block can avoid obstacles?
Haha good ! :D
A neat little editor!
Yes you could, but since it's so calculation intensive, you're better off scripting cutscenes so that the paths is precomputed.
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.
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.
Nice! It looks like it's simple to use. What does the map format look like?
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.
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.
Books, forums, school, and a lot of practice :)