Coding Challenge #71: Minesweeper

preview_player
Показать описание


References:

Videos:

Related Coding Challenges:

Timestamps:
0:00 Welcome!
1:26 All aboard!
2:36 Explaining the logic of the game
4:31 Defining the cells
11:03 Let's make a show() function using object protypes!
17:30 Checking if mouse is inside a grid
20:15 Revealing the cells after clicking
22:58 Checking how many bees are neighboring a particular cell
34:20 Starting to work on the game mechanic!
41:50 Let's implement floodfill!
48:45 Defining when the game is over
51:11 Minesweeper!
53:12 Thanks for watching!

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

#games #prototypes #floodfill #javascript #p5js
Рекомендации по теме
Комментарии
Автор

When starting a new game and clicking on a random tile: To bee or not to bee. That's the question

AnimilesYT
Автор

even if I had a mean day and feel somehow bad watching dan makes me giggle and getting a smile back. he's more human than most of people i know + I dig his coding :) didn't we all wanted a teacher like him

ELHAUKEZ
Автор

One tip for the mouse-click: instead of checking every cell if it contains the mouse when clicked, do simple math: floor(mousex / cellwidth) -> this will return the x-index of the cell clicked. Do the same for mousey. For example - if cell width is 50 and you click on 75th pixel it's floor(75 / 50) which is 1 (x index of the cell). :)

David-vorl
Автор

I'm beginning to sound like a suckup, but boy, you're entertaining to watch coding. Very cool to see this iconic game under the hood. Very satisfying to see it begin to work more and more as we know it!

Manticore_
Автор

While I never code in JavaScript, I'm still learning alot here. My preferred language is Lua, and since JS and Lua are very alike, it's easy to watch these tutorials while coding in Lua. Thanks!

Amayakase
Автор

As someone trying to learn JS just to make a simple game, these challenge videos are perfect! I wasn't aware of p5.js, and it helps make programming much simpler in JavaScript, kinda like how LOVE2D and PICO-8 do for Lua.

juneru
Автор

"You reveal yourself! No YOU REVEAL YOURSELF!"
Omg I have fallen in love with you.

naut_nigel
Автор

17:14 "We don't have too much farther to go"
**video is 53 minutes long**

reimarpb
Автор

Dude, your my fav channel for coding i have come across. This would be my channel if i dod YouTube. Your delivery, topics and interactions. Senior lead dev at 38 and started at 11. For real, one of my top 5 fav channels of all time. Thanks!

FromRootsToRadicals_INTP
Автор

minesweeper was actually the very first large-(ish) thing I every programmed. It was for a BASIC class in high school (and no I'm really not that old, it was an outdated class even then). I used a three dimensional array, which actually worked really well for a language like BASIC, which doesn't have objects that can have properties, but each x, y location could have the different properties it needed (revealed/not, mine/not, physical representation) on one of the "layers" on the z axis. It was a fun project.

nathanjohnson
Автор

This one was amazing to watch. That flood fill function was satisfying.

I think the bee generation should be after the first click so it never hits a bee on the first try!

ArnoldsKtm
Автор

Infinite looping stack overflow easily explained at 46:26
"Hey, neighbor, reveal yourself."
"No, YOU reveal yourself!"

This guy's hilarious. The best is when he gets a bit frazzled by something. Entertaining for the full hour. I love it. You rock!

malik
Автор

I love watching these where you're figuring it out in real time, and record yourself making the same mistakes that all programmers make, more than videos where the programmer is showing what they did and editing out the things like forgetting to return a value or typing [i][i] instead of [i][j].

fedos
Автор

I've just programmed a minesweeper in python and I came to YT to see how other people made it, and now I'm watching you coding it in javascript, which is a language that I don't know, but it's funny how the logics behind our both projects are similar, even the dilema about the neighbor (I came across the same problem with the loop)

ga_per
Автор

I've attempted to learn programming for the last 14 years. I'm finally at the point where I can at the very least understand what a line of code I'm typing is doing. I hope one day I will have knowledge like his in whatever language I'm proficient in.

oDraastiK
Автор

This video saved me, I was trying to made it in C++ for a school proyect and I couldn't find the way to do the recursive part until I found this video. Thank you very much!

chrisalvarez
Автор

17:15 "we don't have too much further to go"
*length of video*: 53:45

dualappsgamer
Автор

Im not sure if anyone has already pointed it out, not that i can immediately see, but splice totally does return the spliced items. The reason it didnt work is because splice returns a new array that contains the item(s), so only splicing one item would mean youd need to just access the first element in the array before looking for your choice index stuff.
So itd look something more like var i = choice[0][0]; var j = choice[0][1];

Keep up the good work and sorry if someone has already said it!

Bolt
Автор

Man making learning new stuff fun again. Thanks and not just coding but thought prep.

FromRootsToRadicals_INTP
Автор

Keeps such a fluid train of thought and debugs with ease. I can only hope that one day I can train my mind to operate the same.

Bromon