The Peg Puzzle Solved (Think Like a Programmer)
Vložit
- čas přidán 4. 07. 2024
- There's a puzzle with 15 holes and 14 pegs that I hadn't solved, and I thought, why am I solving this when I could write a program to solve it for me? You'll see the thoughts behind the program, the mistakes I made along the way, and some discussion of how we should choose approaches that match our programming strengths and weaknesses.
Your comments and suggestions for future videos are welcome.
"Think Like a Programmer" is a book I've written to help programmers with problem solving. If you've found that you are able to read programs and understand programming language syntax but aren't always confident writing programs from scratch, my book can help.
For more information on the book head to one of these:
Amazon page for the book: amzn.to/1MZlmlY
My site: www.vantonspraul.com/TLAP
My publisher's site: nostarch.com/thinklikeaprogrammer
Connect with me:
My site: vantonspraul.com
Twitter: / vantonspraul
Facebook: / thinklikeaprog - Věda a technologie
The code is waaaay over my head but at least I can follow your logic, very impressive
Great efforts
This is unbelievably different from my approach for such a simple thing
Any chance you're willing to share your solution? I have no idea how I would approach it
@@Pulsed101 Id use a 2d array to store the state, which would make the legal move definition much easier, and for such a simple program I would not use any structs. Also, I would not use an extra board state editor that changes a binary number that represents the board state because this would take more time to make than simply writing some input based functions in the code that can visualize the board and let you dynamically change it.
Its very interesting wish you showed all the code
What programming software is this?
(Im a noob)
Why not work it backwards? No need to check "all pegs" if u can just work backward from the hole
Bro, what is going on
u just got dped
Just show the answer .lol