Coding Challenge 51.3: A* Pathfinding Algorithm - Part 3

Sdílet
Vložit
  • čas přidán 25. 08. 2024

Komentáře • 139

  • @ARexplor
    @ARexplor Před 2 lety +11

    You were the channel that kickstarted my JS coding career and made me think it is actually possible to code, THANK YOU!

    • @TheCodingTrain
      @TheCodingTrain  Před 2 lety +3

      That's so nice to hear, thank you for the support!

  • @anatole4115
    @anatole4115 Před 7 lety +141

    I can't code, i don't understand Nothing about code, but damn, this is entertaining as hell

    • @Gregzenegair
      @Gregzenegair Před 7 lety +4

      I already know how to code, I already used (not coded I admit) a path-finding algorithm, but damn, this is entertaining as hell

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety +24

      Makes me so happy to hear! You can start from the beginning here if you want to learn the coding part!
      czcams.com/users/shiffmanplaylists?flow=grid&view=50&shelf_id=14
      czcams.com/users/shiffmanplaylists?sort=dd&view=50&shelf_id=2

    • @beardedjb2273
      @beardedjb2273 Před 7 lety +1

      Hu Wun I would whole heartedly recommend his early videos about learning p5.js. I am enjoying them so much!

    • @senior5904
      @senior5904 Před 7 lety +2

      I would recommend learning programming for fun, its will change the way u look at the world :)

    • @jasonreviews
      @jasonreviews Před 7 lety +5

      You should learn. Coding isn't that hard.

  • @mehmetuslu7796
    @mehmetuslu7796 Před 7 lety +3

    I was searching for maze solution algorithms and found this video series & the channel. Watched all three videos in a breeze. Now I know how to implement the A* algorithm and also know the problems which I may encounter with. This channel is great, very entertaining & fun to watch, very very helpful and the videos are not dull as other channels' videos about this depth subjects. The first thing I checked about this channel was the date of your last video. And it was a couple hours ago. It was a superb relief =) Please let us know how to help & support to keep you making videos in the future. Keep up the good work! Best regards.

  • @amdreallyfast
    @amdreallyfast Před 6 lety +1

    It took several hours of dealing with bugs (infinite loops are the worst; forgot to add noLoop() to the end condition), but I got it! Thank you for the walkthrough!

  • @joonamikkonen2774
    @joonamikkonen2774 Před 7 lety +1

    I've been interested in A* for quite some time and oh boy didn't you manage to make it even more interesting with the entertaining performance you put up there! ^^ Thanks for the video.

  • @NeedHealer
    @NeedHealer Před 7 lety +1

    Must say it was exciting to watch how A* was changing over time and 3 videos were great startin booring but after some time it was awesome to watch and also good luck for next challenge

  • @Chamarel
    @Chamarel Před 3 lety

    I can look at this all day

  • @T0M4C1
    @T0M4C1 Před 7 lety +2

    Thanks for making these videos. I really love learn with you!

  • @igniculus_
    @igniculus_ Před 7 lety +6

    "It looks like lightning in this kind of a crazy way" XD

  • @3zdayz
    @3zdayz Před 6 lety +14

    Could do this with a variation of 'wall' ... instead of wall being true/false make it be 'roughness' 0-10.0 , and then multiply the heuristic by the spot's roughness (oridifficulty to move through that spot) Then you will never get a blocked path, but it should find a path of least resistenence....

    • @Hagledesperado
      @Hagledesperado Před 5 lety +1

      Great idea! Or just pathfinding through a field of simplex noise. :)

    • @cancan2450
      @cancan2450 Před 4 lety +1

      or you can just make the distance from 1 to Infinity. so it is impossible to move to that spot.

    • @3zdayz
      @3zdayz Před 4 lety

      @@cancan2450 that approach sort of failed though a heuristic to get to the end doesn't know the net gradients along the path... you can weight it such that the path with least change is rewarded most.. and applying a logrithmic scalar to the height allows absolute heights to be avoided (ended up getting trapped about half the time not finding a rout anywhere because it's in the middle of infinities like you mentioned :)

  • @Dylems
    @Dylems Před 6 lety +5

    teacher: make storm
    me: take coding train's A* pathfinding algorithm without showing the obstacles

  • @WildTruST
    @WildTruST Před 7 lety +1

    With my formation, I had a work in python for doing this, that was pretty cool to do this c:

  • @torch4762
    @torch4762 Před 3 lety

    Thx for the series

  • @anogrotter1985
    @anogrotter1985 Před 7 lety

    Damn Dan[iel], when did you get 200k subs? Your channel is growing so fast!
    I was really glad when I first encountered your channel and started binge watching so many videos, but I felt bad that you only had about 10k subs when you obviously deserve more. Apparently the CZcams algorithm felt the same way.
    Congrats on [almost] 200k subs! Your videos are great.

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety

      Thanks, yes, it's crazy how quickly it grew in the last month (it's slowed down again now.)

    • @filiperibeiro3607
      @filiperibeiro3607 Před 7 lety

      The Coding Train the youtube algorithm likes you xd

  • @SoDamnMetal
    @SoDamnMetal Před 4 lety +3

    1:22
    Grandpa: What!?!

  • @kensoko0l
    @kensoko0l Před 7 lety

    nice video, you just simulated lightning. very cool

  • @jawad9757
    @jawad9757 Před 4 lety +1

    Technically, when it goes diagonally, it is sqrt(2)-1 longer than going vertically or horizontally

  • @MrOdammy
    @MrOdammy Před 7 lety +4

    please do a series on neural networks

  • @ErnestGWilsonII
    @ErnestGWilsonII Před 7 lety +1

    Your videos are awesome Daniel Shiffman! Thank you for making these and please keep making more! Question: Is there a list someplace we may reference for upcoming topics and upcoming live streams?

  • @disko.kommando
    @disko.kommando Před 7 lety

    good stuff, more surprises please :) I would love to see you reorganize and possible 3d this concept.

  • @EliteWheatProdctionZ
    @EliteWheatProdctionZ Před 7 lety +5

    Dan, could you do a lesson on Quadtree collision detection? its quite interesting.

  • @deutschWallah
    @deutschWallah Před 2 lety +1

    Really interesting Dan. Let us build this in C++ someday if you like :)

  • @amressam8184
    @amressam8184 Před 7 lety +1

    Can you do a machine learning challenge? It'd be really interesting to see how you'd go about it :)

  • @veeml7953
    @veeml7953 Před 7 lety +3

    LIGHTNING GENERATOR TUTORIAL!!!

  • @Hyuts
    @Hyuts Před 5 lety

    Very amazing coder!

  • @firephoenix5556
    @firephoenix5556 Před 5 lety +1

    Your end music should have a train whistle in it

  • @bripbrap
    @bripbrap Před 7 lety

    Well done, awesome stuff! :D

  • @codingforest7442
    @codingforest7442 Před 3 lety +1

    Actually when it goes to diagonal neigbor the g cost should be greater than normal neighbor g cost, according to pythagorean theorem

  • @GogiRegion
    @GogiRegion Před 5 lety +2

    The way that I used A* in the game I’m making is done in such a way is that it calculates the route and follows it every frame.
    The way that it works for frame based is that when it finds the route, it will trace it back to the last tile before it gets back to the object, and then gets the angle to move based off of which direction it traces back from. This lets it calculate the route and work every frame.
    It also has it to where if it gets too many tiles in the closed set, it will just use the angle to the player, which works to prevent frame drops. That threshold is going to be changeable in the AI settings so that you can change the tradeoff between good AI and CPU intensiveness.

  • @koresh2078
    @koresh2078 Před 3 lety

    Wow!111 just wow!!! 🤩

  • @AmiruddinAyaz
    @AmiruddinAyaz Před 7 lety

    LOve your videos man..... keep up the good work. Would love to see a coding challenge Hasse Diagram :)

  • @sankai91
    @sankai91 Před 7 lety +2

    Could you make a Sudoku-solving algorithm?

  • @lukegarrigan5894
    @lukegarrigan5894 Před 7 lety +2

    Hey man love your videos, have you ever considered using Prolog? Especially for pathfinding and graph traversal algorithms like A*. I watch your videos as I enjoy your thought process to figuring out a solution, I'd love to see your thought process in a declarative language.

  • @darkoradun
    @darkoradun Před 7 lety +1

    Hello everyone! :D
    Since I am just getting into programming(Java) I would like to ask how can this be translated into Eclipse (what to add/take)? So what are the main differences between Java and Processing, as I understand Processing is based on Java lingo - take away a bit of its less pretty syntax?
    Ps. Two videos in, I had to hit subs, his explanations and energy are so refreshing! Love these Coding Challenges!

  • @elishmuel1976
    @elishmuel1976 Před 5 lety

    Hi Daniel, learning and loving JS through your videos. I should join a local coding group or something (if that even exists): Need to share my pasion and excitement with someone.

  • @stenzenneznets
    @stenzenneznets Před 7 lety

    Keep it up!

  • @torlumnitor8230
    @torlumnitor8230 Před 3 lety

    It looks like lightning because that is how lightning works.

  • @sammflynn6751
    @sammflynn6751 Před 4 lety

    Sir,please do a video on LPA star and Dstar-lite

  • @VolcanicArts
    @VolcanicArts Před 7 lety

    This is awesome. I hope to be a programmer some day too :D

  • @CSBDEEPNITINMAHESHWARI

    love from India!!! Hell loving the coding now Would like to contribute something creative as well.

  • @ranielgarcia8685
    @ranielgarcia8685 Před 4 lety

    where to find the dist method code on the heuristic method on this tutorial?

  • @himself99
    @himself99 Před 7 lety

    I am very sad ..
    U deserve 2 million subscribers and more with time!!!
    😊😊😀😀😎😎

  • @Texplanations
    @Texplanations Před 7 lety +2

    "It's what it is" seems like you just watched Sherlock season 4 The Final Problem.

  • @k3ck3m3n
    @k3ck3m3n Před 7 lety

    Hi, this was awsome! How about implementing some code, to get to other optimal solutions. (If there are some) In most of the cases there will be more than one optimal path.
    I mean if on ur optimal way back home, there is a criminal waiting for you, which is not an obstacle, but sucks anyway, you will be really happy, if there is an other optimal path :D

  • @hadidahi3876
    @hadidahi3876 Před 7 lety

    could you please make advanced P5.js tutorial. Thank yoh very much for your efforts

  • @experimentators8699
    @experimentators8699 Před 5 lety

    i know this video is old but i would really like it if a tick speed was added, so that multiple steps can be taken in 1 frame, i know nothing about p5 but i have javascript skills so i might implement

  • @NathanBreunig
    @NathanBreunig Před 7 lety

    Can you do a video on how you set up your coding environment?

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety

      Yes, I should do an updated one. Here are some recent and mostly still relevant ones:
      czcams.com/video/UCHzlUiDD10/video.html
      czcams.com/video/d3OcFexe9Ik/video.html

  • @Potahsium
    @Potahsium Před 7 lety

    Do you teach coding on youtube? Cos i would really like to learn the basics before i actually go to school learning more coding next year. If so do you have a link or something?

  • @jacobmpp
    @jacobmpp Před 7 lety +2

    maybe you could try to make a chroma key background replacer from scratch
    a green screen coding challenge

  • @adnankubat545
    @adnankubat545 Před 7 lety

    In your opinion, what is better to learn, c++ or js. I am beginner and i don't know what is better. Thanks if you can answer me and sry for my bad english...

  • @piguinwolves4441
    @piguinwolves4441 Před 7 lety

    First! Awesome challenge too!

  • @prakad97
    @prakad97 Před 7 lety

    Is there any previous video to install p5.js and using the editor..processing and how he shows the output in browser..can anyone link it if any..

  • @Timooooooooooooooo
    @Timooooooooooooooo Před 7 lety

    "We do want this to have a stroke" :D

  • @himanshu2024
    @himanshu2024 Před 6 lety

    That's how you make thunder strike :P

  • @cacowen
    @cacowen Před 7 lety

    Thanks for the great vid. I was watching live and it was one of the best live vids I have seen. Very entertaining. - When I draw the vector line it does not get refreshed it seems. It just draw a new line over and over again resulting in the PATH having multiple dead end results. Is there a trick to removing the old line each time. I guess I missed something.

    • @cacowen
      @cacowen Před 7 lety

      I am doing things a bit differently though - my code is here: github.com/cacowen/a_star

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety

      thanks for sharing!

  • @JohnnyCarlsen
    @JohnnyCarlsen Před 6 lety

    I love this videos, but I wonder why make this function " this.removeFromArray(this.openSet, current); ",
    when you just can write " this.openSet.splice(winner, 1); " ?

  • @FrostZone
    @FrostZone Před 7 lety

    also does it ever get annoying having everything enlarged?

  • @matik282
    @matik282 Před 7 lety

    How would you write lightning generator?

  • @hamzaisk9462
    @hamzaisk9462 Před 7 lety

    i write a code in Android mode but when i run it i get error. i run same code in Java mode everything is running . how can i run My code in Android mode without error?

  • @hcarrapico
    @hcarrapico Před 7 lety

    Please make a video where it tries to find a way on the maze generated by the code you made, please please, i am not very good at this sttuff

  • @I_Am_Redeemed197
    @I_Am_Redeemed197 Před 7 lety

    HOW DO YOU OPEN JAVASCRIPT FILES IN YOUR BROWSER? I've been trying to figure this out for ever and I don't have a clue. Clicking and dragging doesn't work.

    • @gordonfreemanthesemendemon1805
      @gordonfreemanthesemendemon1805 Před 6 lety

      Make a .html file with a tag to your javascript code
      The html file should be something like:

      Put the .html file and your .js file in the same folder, and then simply double click on the .html file to open it in your browser.

  • @DragXGaming
    @DragXGaming Před 7 lety

    would this be a lot different in java?

    • @WhyDoIBeHere
      @WhyDoIBeHere Před 7 lety

      Sure as you have to deal with awt and swing or JavaFX for graphics, which is good for designing UI, in p5 javascript its easier to draw this kind of graphics. In Addition, stuff like object oriented coding and inheritance is more complicated to write in Java

  • @amadeoleiton8492
    @amadeoleiton8492 Před 5 lety

    Hey! I’m interested in coding. A question, when coding JavaScript in the app atom, how do I run the code in the web?

    • @ChrisWi88
      @ChrisWi88 Před 5 lety +1

      Embed the javascript in a html page and open that page in the browser

  • @markuseby5267
    @markuseby5267 Před 7 lety

    Going to school for cs I get in trouble for free coding. If I don't have a pseudo coded algorithm I lose a letter grade whether it was done correctly or not. But I get my best work done free hand that's when I get into stuff I don't understand and get it to work

    • @DuhBroadcaster
      @DuhBroadcaster Před 7 lety

      markus eby school is overrated

    • @markuseby5267
      @markuseby5267 Před 7 lety +1

      its all a perception, I just know I won't have the drive to continue do do what I need, I do realize that I do not need to go to college to get a codding job, but I want to, so I can get more structure in my education, while I self teach, and watch videos in the side of programming and computers that I don't get out of school.

  • @archie6498
    @archie6498 Před 7 lety

    Hey Dan, can you make a video about gift wrapping algorithm ?

    • @rinovethamoses124
      @rinovethamoses124 Před 5 lety

      Although late Check this github.com/rinovethamoses97/Gift-Wrapping-Jarvis-Algorithm-Visualization

  • @rizubiswas6656
    @rizubiswas6656 Před 5 lety

    Can anyone suggest me how I can modify this code to convert the obstacles into only nodes possible to travel and find the shortest path to the destination?

    • @firephoenix5556
      @firephoenix5556 Před 5 lety

      Switch this.wall to defaultly be true and when the code picks walls set it to be false.

    • @aichabenlahrech635
      @aichabenlahrech635 Před 5 lety

      I ask :
      Why in the 2nd video the spots moves in same time (i mean the x and y moves in the same same time )?
      Because he have the same (g) and same (distance) ? Every path is optimal and there are no best (g) and distance ?

  • @recklessroges
    @recklessroges Před 5 lety

    Rather than "no solution" it should default to "solution that ends closet to the end"

  • @MinthZe
    @MinthZe Před 7 lety

    you should make key points that it must go through

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety

      Great suggestion!

    • @FloMoTionDJ
      @FloMoTionDJ Před 7 lety

      so you want to iterate over a set of endpoints?

    • @AndrewBone
      @AndrewBone Před 7 lety

      The Coding Train if end changed part way though would it just cope?

  • @BigJim777
    @BigJim777 Před 7 lety

    Hi, do you leave copies of your final code, that we can download and look over ?#

    • @dropyghost
      @dropyghost Před 7 lety

      check the description of the video, he post this code in github.

  • @leaderleader5608
    @leaderleader5608 Před 7 lety

    Can you code a "Rapid Roll" game

  • @HeuschnupfenDevelopment

    250k!

  • @bikewaynarrows9212
    @bikewaynarrows9212 Před 7 lety

    do you have tutorials on your channel about how to use these coding programs?

    • @TheCodingTrain
      @TheCodingTrain  Před 7 lety

      Yes! These are the two "Get started from scratch playlists":
      czcams.com/users/shiffmanplaylists?flow=grid&view=50&shelf_id=14
      czcams.com/users/shiffmanplaylists?sort=dd&view=50&shelf_id=2

    • @bikewaynarrows9212
      @bikewaynarrows9212 Před 7 lety

      The Coding Train thank you!

  • @madhunugg
    @madhunugg Před 7 lety +3

    What happens when the end is a moving target?

    • @creepy99
      @creepy99 Před 7 lety +6

      That's what I was thinking. Generate a maze and imagine a strobing rainbow dot (a unicorn, of course) wandering randomly through the maze being chased by the A* algorithm.

    • @maltebp
      @maltebp Před 6 lety

      Wouldn't you have to "reset" the pathfinding and set the start to the point where you left off, and set the new end point to the position the unicorn? Not sure ofc - still just starting to learn about pathfinding.

    • @markotikvic
      @markotikvic Před 5 lety

      @@maltebp If you take the last best evaluated node as your new starting point you could end up with a problem if the target loops back to your original starting point. You would end up retracing your traget's steps and end up with a lot longer path than the shortest one. You should reset the algorithm if the target has moved more than some set treshold if that is the way you want to take it. But A* is better suited for non moving targets.

    • @Hagledesperado
      @Hagledesperado Před 5 lety

      Or make the beginning move as well. Every time the target moves, set the beginning to the closest point it's reached so far, and restart the algorithm.

  • @muabyt7333
    @muabyt7333 Před 7 lety +2

    PLS MAKE A NEW VIDEO ;( IM MISSING YOU

    • @muabyt7333
      @muabyt7333 Před 7 lety +3

      still missing you ;(

    • @muabyt7333
      @muabyt7333 Před 7 lety +1

      omfg pls xD

    • @dropyghost
      @dropyghost Před 7 lety

      Im with you, just watching some of the old one while he publish a new one

    • @muabyt7333
      @muabyt7333 Před 7 lety

      cmon mr shiffman xD

  • @martvandebruinhorst9907

    1000th like

  • @kuskus_th13
    @kuskus_th13 Před 7 lety

    Found this video xD

  • @deadly_artist
    @deadly_artist Před 3 lety +1

    Just a quick disclaimer. Even the improved version works horribly. Don't use this in an actual application. There's lots of bugs and unnecessary inefficiencies that could be fixed with like one line of code. Or at best just rewrite it entirely. But interesting video nonetheless.

  • @archtaurus
    @archtaurus Před 7 lety

    it can not be the A*. it is now too slow!

  • @guygeva7375
    @guygeva7375 Před 7 lety

    Where is part 5?
    You need to read the stream chat to understand.

  • @chakoyaki
    @chakoyaki Před 7 lety

    Teach me to code

  • @skeletar85
    @skeletar85 Před 6 lety

    I love your videos and they inspire me to code as much as i can. I made a python version of this project on my blog!
    progressingprogramer.wixsite.com/blog

  • @RodrigoKulb
    @RodrigoKulb Před 4 lety

    Hello Dan congratulations on the content of the videos. I did a test with pathfind, I have a question. if you see in the example. rodrigo-kulb.com.br/rota It works sometimes and sometimes it doesn't work. could help?
    if you reload page it works sometimes