I REALLY appreciate these sorts of coding videos where someone explains the logic and thought process behind the code they write. I feel like this kind of thing is very sorely lacking in a lot of programming tutorials. It's not so important that you know WHAT code to write as much as WHY you would write it in the first place.
@javidx93 жыл бұрын
There's a full video about containers and why/how to choose them prior to this one. The simple answer is, it genuinely doesn't matter in this instance.
@dutu0003 жыл бұрын
YES! Me too!!!
@Briglair3 жыл бұрын
Exactly! You don't learn anything by someone just saying "do this, do that." You learn how to copy from a screen, not how to apply logic on your own. I love this channel
@_miyu3 жыл бұрын
@@Briglair I feel very similar with music. I used to play the Trumpet when I was young and all we did was play exactly what was on the sheet. Later I tried to pick up Guitar. After awhile I noticed I was just memorizing chords and playing back exact songs that I happened to like. That never really worked for me. Now I really found what I am good at, I love to code and I have the ability to think problems through and generate my own real solutions. It is certainly a pleasure to see videos like this one, that show you how reason your way through problems.
@johnneighbor98663 жыл бұрын
@@Briglair Yep, and then concluded with, "and that's how you do x" and any viewer is just left there sitting like what did I waste 4 minutes watching, because in those, "type this, then this" there's no learning really promoted at all. Where Javid on the other hand, goes quickly but explains details as well, and being video, backtracking 10s is 100% a doable task.
@kadensharpin21563 жыл бұрын
"I don't like regular expressions because fundamentally I don't understand them" that hit close to home
@DFPercush3 жыл бұрын
Regular expressions are like the vim text editor. Everyone who's devoted the time to learning it, swears by it. Everyone else is frustrated and annoyed by its existence.
@TotalImmort7l3 жыл бұрын
@@DFPercush Cannot agree more.
@zakkiedude1323 жыл бұрын
@@DFPercush particularly accurate because to really get the best out of vim you've really gotta learn how to :%s/regex/replacement/g
@ShadowRadiance3 жыл бұрын
There's a saying that "if you have a problem and solve it using a regular expression, you now have two problems."
@DFPercush3 жыл бұрын
@@ShadowRadiance lol... only if you have to understand it later
@salockin95153 жыл бұрын
i really hope you don't stop making videos because I really love your calming pace and voice and I love using your olc engine
@javidx93 жыл бұрын
Thank you, no plans on stopping, will have a couple more this year I hope, but been on hiatus with my new family since summer.
@StuartLoria3 жыл бұрын
At college we used to say “Practice Only on the days you wake up” If you’re in a comma, bedridden or dead, you are excused.
@delgadogorn2 жыл бұрын
Your videos are amazing, very thorough and informative. I am only at the beginning stages of learning to program and understand very little but I still love how you explain the logic behind programming which most do not. You are one of the only few who inspire me to keep going. Keep up the great work!
@wolverine96323 жыл бұрын
One of my proudest programming accomplishments was writing a full-featured single-player yahtzee game in BASIC on the Vtech PreComputer 1000.
@stephenelliott70713 жыл бұрын
An excellent video! I love breaking down a tricky problem and getting the program just running bug free (I call it the first hurdle). Then look to refine and refine the algorithm to make it more and more efficient - also more concise. Something you did particularly well here. Great stuff.
@piratux28603 жыл бұрын
What a lovely video. Simple, yet some parts have depth in it.
@ziolkovy3 жыл бұрын
@javidx Great video! (as always) One thing I noted: Maybe I do not know rules of game, but for me small straight pattern looks wrong - for instance 12234 don't match. Also five of a kind can be treated as full house, which shouldn't be possible. I think it is a good idea to set few dices sets manually for testing and then use random.
@bryceschultz72153 жыл бұрын
At 33:35 you have a small straight but the pattern match doesn't find it because there are two fours keeping the straight from being consecutive.
@maurinavoni69253 жыл бұрын
.
@not-on-pizza3 жыл бұрын
So I wasn't the only one yelling "BUG!" at the screen at 20:32, then!
@henrykkaufman14883 жыл бұрын
@@not-on-pizza yep I'm on that very moment when he's explaining small straight pattern match and I'm looking in the comments to check if indeed I found a bug. But hey, everyone makes bugs, this will make me more forgiving towards myself.
@NillKitty3 жыл бұрын
Yep 1-1-2-3-4 also wouldn't match those patterns.
@McErer3 жыл бұрын
@@NillKitty or double 2s or 3s. I was seriously annoyed by that flaw :p
@Nioub3 жыл бұрын
To detect the full house, you can encode it in "nnnmm" and "nnmmm", handling the m value exactly as the n value (but in a separate variable).
@whinebite3 жыл бұрын
Reading this under the effects of sleep depravation only made me imagine those as microwave sounds
@Loleexer3 жыл бұрын
You're a genius! I've got to learn how to optimise my code like that. It does happen sometimes that I write a neat little piece of code which does a lot, and I do get praised for it at work, but often times I rush to another tasks at hand without really thinking about what I wrote and of ways of making it better. Often times do I go back to my code only to realise how terrible it is at a first glance. Such inquisitive and robust optimisation will definitely take some time to learn, but the end result seems to be more than worth it! I'm glad I decided to watch this video.
@田淞煜3 жыл бұрын
I have learned so many things through your videos. You are the kind of person I always wanted to be. Please continue to make more this kind of useful videos. I will be very, very grateful to you and hope you and your family will always be healthy!!!!
@JanKjeldsen3 жыл бұрын
Yatzy was the third program I wrote in high school in 1981. Programming language was Comal, a Basic derivative. The program worked but lacked structure. Learned the need for subroutines the hard way :) Did I forget to mention it was written on punch cards for a RC-7000 computer? It had 326 lines with no blank lines, why waste a card? On par with this C++ program, but mine had the computer play against you!
@EzioOmer3 жыл бұрын
You could be the reason that fostered me to learn c++ i did not start c++ yet but i am thinking it currently . Love your videos !
@d3r1n3 жыл бұрын
Well I saw the discord status "Uploading a video" and came here. I love your videos so much as a kid who obsessed with computers and stuff you are my hero when it comes to programming
@utkugokalp31793 жыл бұрын
Great idea to shoot a video about this, even the best need it sometimes
@barellevy60303 жыл бұрын
Hey, great seeing you upload! How's things with the new addition to the family? Hope you are all in good health and adjusted as much as it's possible to adjust :-)
@trivedi.arindam3 жыл бұрын
You make awesome videos! I found your channel now and this is the best thing ever! You videos make me wonder if anyone need graphic engines like OpenGL or SFML.
@DavidBauer383 жыл бұрын
I was literally just thinking about doing a Yahtzee clone in Golang the other day! Looks like I need to get going! thanks for the inspiration, @javidx9!!!
@petacardi2 жыл бұрын
Really insightful video! It is really nice seeing smart people writing code. Thanks!
@Juniper45713 жыл бұрын
How I do it: 1. Search for some absurd idea on the internet or think of something actually useful :) 2. Just do it 3. Get frustrated, but also just do it 4. Finish the project in an acceptable state
@dieisonmarianofariasrocha72353 жыл бұрын
Amazing video. It was 34 minutes of learning new things. Thank you so much for this video.
@Bravo-oo9vd3 жыл бұрын
Really liked the the focus on expressing the logic as succinctly as possible. With this in mind, have you considered looking into some functional programming languages, eg. Haskell and maybe doing a video about them in the future? Imperative languages can be a bit verbose at times, and functional programming can be really "logic-dense", but things like monads, functors, applicatives, and all the other category theory jazz can be a little daunting at first. Would love to see something like this on your channel, even if it'd be only one or two videos.
@antoruby3 жыл бұрын
A true game programmer: coding, refactoring for fitting the screen, and taking shortcuts in algorithms only with the power of manual testing! Sarcasm aside, very nice example and I like how you walk us through your design process.
@mailenolivera15233 жыл бұрын
I'm learning a lot from this video !! THANK YOU !
@danteculaciati16563 жыл бұрын
Love your videos man! Thanks for all your advice and the enthusiasm you put into them.
@zach_attakk3 жыл бұрын
As a pedantic board gamer and coder, you have no idea how happy I am to hear the proper plurals for die/dice
@Strickredmusic Жыл бұрын
Really great content dude!
@drummsnikk50733 жыл бұрын
Always a pleasure to watch your videos ❤️
@surters3 жыл бұрын
The good thing about videos like this is they show a different way of programming than I would have chosen. In this case my immediate thought would be the sum array of a counting sort would have given most of the matches and std::adjacent_difference might be usable for finding straights.
@marcosdantas42583 жыл бұрын
i really love your videos javidx, thanks for the great content, i can see how computers have strong love for know values at compile time and he hate loops hahaha, on the last minutes of video you improves code quality by using vector and loops for computers aspects and aspects of FP libs and your fps drop 385 to 345 times, is incredible how things can be wrong if we adopt bad solutions for some cases, for me games is the more significant area to learn and improve your knowledge about computers and programming language.
@bradp2133 жыл бұрын
I wish I knew about this channel when I was in college. Great video! Thanks
@l6e6i6n3 жыл бұрын
Always enjoy your videos. Keep up the good work 👍
@Nuvhandra3 жыл бұрын
Amazing, thank you again for a great video. "It's all about the journey rather than the end result", Cheers
@thecakeredux3 жыл бұрын
21:10 Missed an edge case there. 34566 is a possible roll for a small straight not covered by ?3456 or any other of the four patterns. Also true for rolls with duplicates that aren't at the beginning or end of the pattern.
@bestformspielt3 жыл бұрын
came here to say this.
@Surf_Cat3 жыл бұрын
Yahtzee is a nice choice when learning programming farmeworks/languages, it has a nice range of tasks. If you manage to decouple the logic (maybe iteratively) you can use it as a library to test gui or other stuff. I used this to figure out listboxes etc.. in gui frameworks, some 3d stuff and a lot of other new stuff when learning.
@blinded65023 жыл бұрын
That's one hell of a thumbnail, looks awesome!
@alexstone6913 жыл бұрын
24:00 why don't you just return false if any of the conditions don't match? Aren't you looping unnecessarily if first dice don't match a rule
@trellend3 жыл бұрын
You need a remove duplicates on your small/large straight before your test, and change your test pattern.
@joemaffei3 жыл бұрын
I was just about to type this, as i noticed the 3 4 4 5 6 at the tail end of the video not registering as a small straight.
@ernopakarinen93613 жыл бұрын
Bit simliar as you :) My practice to learn new stuff has always been to take a new project and just start doing it in the new environment and/or new programming language you want to learn. I always learn best by doing things as I am not a scientist with a lot of background theory support (just a Bs.C). That is how I started back in 1982, I wanted to learn how a game was made, spend to do Basic interpreter stuff first with that comp and when I found new tools like Asm interpreter/compiler I went there and after a while to C :) But I think it's pretty much what you are doing here as well. Learn by doing, pick a project and find solutions for how to complete the challenges. It's "xanakig" from your Discord btw :P Good video yet again.
@TheSgrizli3 жыл бұрын
Thank you bearded man for the knowledge.
@leonm89063 жыл бұрын
Hey, I did the same game in python as a coding exercise. It's called Kniffel here in germany.
@teucay73743 жыл бұрын
As inspiring as always. Thanks for all!
@JaycenGiga3 жыл бұрын
As others pointed out, there was a bug regarding the small straight rule. I think this comes from using a vector, which is a suboptimal data structure for the problem. As I see it, the most appropriate one would be a multiset which is also part of the standard library and so would not only be a perfect fit for the problem but also you would likely learn something new. Then, you could simply define a multisets for all the rules and do matches by checking for subsets, without using patterns.
@ignabelitzky3 жыл бұрын
"Generala" is the name in Argentina... such a nice game!
@nonchip3 жыл бұрын
to add to the language trivia: in germany we call it "Kniffel".
@MaksFam3 жыл бұрын
Thank you for the awesome videos man!
@bestformspielt3 жыл бұрын
I would have sorted the input to the PatternMatch function inside the implementation. It is odd that a requirement of the function is that the input must be sorted beforehand. Not a common thing for an interface. :)
@JT-ky6ov3 жыл бұрын
Please tag @everyone in the Discord when the any day now @34:11 has finally come
@esun4113 жыл бұрын
영상 항상 잘 보구 있습니다!
@nokiaa33373 жыл бұрын
I love you so much man , i dont know why really. You looks wonderful good and determined person maybe thats why RESPECT.
@tibfulv3 жыл бұрын
Basic regexes are really quite simple. You can do really complex things with them, but that's common in programming. The concept is quite similar to globbing. All words match themselves, '.' matches any character, '?' means zero or once, and '*' and '+' means repeated zero or more and once or more. If you need more fine-grained control, curly brackets controls repetitions, square brackets pattern matching. Also, you can match the beginning or end of the line with '^' and '$'. Anything more is implementation-dependent. In C, you compile a regex with regcomp() and match it with regexec(). In C++, things seem different. But the relevant funtions for both are in regex.h. www.geeksforgeeks.org/write-regular-expressions/ www.geeksforgeeks.org/regular-expressions-in-c/ www.softwaretestinghelp.com/regex-in-cpp/
@noblesavage1493 жыл бұрын
Wow... I need something to get my teeth into as I've been losing the plot as a front end developer. Going to implement this in first one language and then use it as a base to learning other languages. Thanks dude!
@alvfig3 жыл бұрын
Great content, thank you so much!
@ErtosAcc3 жыл бұрын
17 minutes in and I'm losing focus. Rewatching later. I can recognize a great video despite not knowing anything about C++, and this is one of them. Provides a refreshing view on programming.
@prinnydadnope57683 жыл бұрын
The small straight isn't limited to 4 values : 1234?, ?2345, 2345?, ?3456 would work if all dice had different values, but fails if a value is shared. The earliest example is 11234, the ? is in the first spot. Or even 12234, where the ? is the in second or third spot. Great video overall, thank you for making this. People often underestimate "little projets", but it's by doing projects of all sizes that you progress, not just big ones.
@TrollingAround3 жыл бұрын
Pattern matching - Small straight, you missed a pattern for 11234 (?1234) and 34566 (3456?). Good vid, thanks got my brain thinking :)
@not-on-pizza3 жыл бұрын
Actually more than that, because you also need to account for Small Straights where one of the middle values is repeated.
@TrollingAround3 жыл бұрын
@@not-on-pizza - Of course! so also 12234, 12334, 23345, 23445, 34456 and 34556 - did I miss any?
@FiddlesMcGee3 жыл бұрын
@@TrollingAround I believe there are 16 possibilities for a small straight, which I think can be covered using these 8 patterns... { "?1234", // *1* 1234 "12?34", // 12 *2* 34 or 12 *3* 34 "1234?", // 1234 *4* or 1234 *5* or 1234 *6* "2?345", // 2 *2* 345 or 2 *3* 345 "234?5", // 234 *4* 5 or 234 *5* 5 "?3456", // *1* 3456 or *2* 3456 or *3* 3456 "34?56", // 34 *4* 56 or 34 *5* 56 "3456?" // 3456 *6* }
@puncherinokripperino25003 жыл бұрын
i think hardcoding each pattern was a mistake, coding the logic would be much cleaner, and he could practice std::unique in patterns of N consecutives
@superfunfactory88933 жыл бұрын
9:30 I'm learning C++. What is the reason you are using cpp17 instead of cpp20, since you say cpp20 would have the 'contains' function you need? Thanks for any help
@javidx93 жыл бұрын
At the moment all my software targets 17, over the next few years ill start using newer features but I never rush to use them. Often they need to mature a bit first.
@superfunfactory88933 жыл бұрын
@@javidx9 ah i see. Thank you
@not-on-pizza3 жыл бұрын
About the "quick and dirty" way of reducing a string character to a digit at 23:40... I'm not sure about C++, but the C standard library guarantees that this is correct _only_ for the digits '0' to '9'. It does not guarantee it for any other part of the character encoding.
@inspisiavideos85423 жыл бұрын
Hi! I have a question but I think it's more like an advise. I got a paid internship at a company that protects data for hospitals. The internship first day introduction day (last week) I was told by HR and some senior employees that I will be rotating first doing QA Engineering job (testing apps from the developers, watching out for bugs, zoom meetings and scrum). Then I'll be rotating to write code in Java. HR later gave me a Powerpoint presentation and one of the slides had info about all the job positions people can apply to and get a bonus by bringing in a new recruit. But the HR lady said it does not apply to interns. During my first week I have done nothing but trainings and explanations of the platforms. I feel like it's a lot for a team. So, the question is if with all this, do you think if I ask them if I could stay permanently there or to have my stay there extended. If so, at what point I should ask? My full time internship ends ending August. My concern is that I did the decision of quitting my previous job as an Assistant for nurses in order to have this opportunity. Just in case I signed up for algoexpert and train coding problems so I can be prepare and start applying to jobs at other companies. But, I'm concerned about this because I have 3 months before my income ends. Please let me know.
@VincentGroenewold3 жыл бұрын
Absolutely love you sharing the process, this is so valuable. My big question, as a beginner, is... how long did it take you to come up with the other ways? Is this where, basically, the difference lies between experience and just being clever? :)
@rethanon3 жыл бұрын
Loved the video, would be good to see how you implement the rule where a "turn" is actually 3 rolls, and on the first two rolls you can decide which dice to keep as you attempt to go for a particular goal (i.e. you don't roll all 5 dice every time)
@DarkVigoole3 жыл бұрын
Nice video. Do ?1234 pattern will be matched for small straight ?
@srpskihayk3 жыл бұрын
Some 40 years ago, I did this in BASIC on a Radio Shack Color Computer, and later on a Color Computer 2 using Extended BASIC. I see the methods have changed just a tad. (that is a joke). Great work!
@ross92633 жыл бұрын
Sometimes the most entertaining and engaging videos are ones about personal growth of a topic the viewer and creator are both interested in. Take a golf youtuber I watch: golf sidekick, almost always makes videos about a game he played that day and his thoughts throughout the match. his videos are about his own personal growth as a golfer.
@ZordidMuc3 жыл бұрын
I think there's a problem with the patterns for small straights. 1234? for example can only match to 12345 (a large straight also) or 12346 - but what if I have 12234? Which pattern should match that?
@glizzdawiz3 жыл бұрын
I've been wanting to do this with DnD scoring, dice and experience calculation.
@casperes09123 жыл бұрын
DnD Beyond has an API you can hook into to get character sheet info if you want :)
@glizzdawiz3 жыл бұрын
@@casperes0912 cool thank you
@jsflood3 жыл бұрын
One word. Awesome!
@zettelkastendev37603 жыл бұрын
thanks for this, I really struggle with coding right now
@jaredbowen8273 жыл бұрын
This is the simplest program you've done. I've done this to my TI-89 Calculator YEARS ago. It's a good way to learn how to code in SEVERAL coding Languages.
@insoYT3 жыл бұрын
Probably ten out of ten times I'd have gone with RegExp and never looked back 😂 But I must admit that I liked to watch that little puzzling. RegExp sometimes feels annoyingly repetitive work without able to just copy&paste old solution. However I feel like with RegExp this logic would have been more readable. I believe I'd have also chosen "if(yyy && xx)" over "if((nnn?? && ???nn) || (nn??? && ??nnn))" for formatting. 👍 Programming would be boring without challenging our approaches 🤓 Great video, thanks!
@tomvito3 жыл бұрын
Great video 👌🏻Thank you!
@abdulazizrakhimov77013 жыл бұрын
Hello Javid!) I missed you so much!) Please, I want you to release videos oftenly, because you make me to think like a geniusly boy!)🤗
@sigmundfreud44723 жыл бұрын
Thanks for the video! It reminds me of when I was just starting out, I wrote some code to simulate the game “Left Right Center”. It’s completely a game of chance, except if you can choose your place in turn order. We had been playing it a lot (for money!) and I wanted to guess what the best place to start would be. Long story short, it seems the odds of winning increase the further in turn order you are, with great effect the fewer players there are. (With two players, Player 2 has a 70% win rate!)
@Michmanjuga3 жыл бұрын
9:38 The std::set actually has the method "find" which will return an iterator to the searched element if such an element exists otherwise std::set::end() will be returned. So you may write something like: auto faces = std::set{ 2, 3, 4, 5, 6 }; if (faces.find(nFace) != faces.end()) { // ... your logic }
@GonziHere3 жыл бұрын
Spot drawing - great insight into the development of an algorithm (and the value of not using the first and fastest solution) But the result is harder to expand to say 7,8 and 9 values (it uses "hacks" that work only inthis exact scenario, its the opposize of robust). But again, great video especially for junior programmers who dont understand these continuous improvements (or the prototyping value of the first code) That was just a nitpick :)
@DFPercush3 жыл бұрын
My first thought beyond the "brute force" method was to use truth tables and Karnaugh maps, but that involves breaking the value into bits first. I wouldn't have noticed that symmetry the way he did it, and the code he ended up with is probably faster. But my way would have been branchless, sometimes that matters (not here tho). The only other dot-face thing I can think of that has more than 6 values would be dominos. I wonder what that would look like... but as you said, it's a very constrained problem here, and why solve problems that you don't have to. :P
@apfelnymous53673 жыл бұрын
You happen to know a linux alternative to one note ? I looked this up but most lack of a grid...
@my_temporary_name3 жыл бұрын
Oh, so this is how it's called in English! Very nice kata. Btw, having a pair and two pairs is good for game balance because you often end up with just pairs when trying to throw something more difficult.
@lfmsmka3 жыл бұрын
Quick question I’m new to programming so don’t be harsh on me :), why not use “using namespace std;” instead of having to write “std::” every time?
@javidx93 жыл бұрын
Its a good question - its simply a matter of preference and habit - Ive become so accustomed to it that I dont even notice. There are some technical reasons why its good, but only when projects get larger than a single file like show here. I made a video about this called Forbidden C++.
@modify31683 жыл бұрын
From what I've read and programmed so far, part of it has to do with knowing which namespace each class is being referenced from in large projects. For example cout, for printing to the command line, could be declared and defined in the standard (std::) namespace in iostream or in another included library or created by the programmer current making the project. Having "using namespace std;" at the beginning would make it confusing because then you wouldn't know from which namespace cout is being used.
@tommytomtomtomestini38943 жыл бұрын
I believe it is frowned upon due namespace pollution.
@yusufklc78213 жыл бұрын
Standart library is huge and if you're working with other really huge libraries or you have some huge libraries of yours than probably some of function names will be duplicated. And you won't be able see which function you are using for example. There other issues but this example is classic one and common one.
@lfmsmka3 жыл бұрын
@@modify3168 oh wow okay thank you, ill keep a note of that and see if I can get used ti write the name space instead of using "using namespace std;"
@megaxlrful3 жыл бұрын
I will probably never forget my first time playing yahtzee. I barely understood the rules, and my first roll was a yahtzee with fives. Talk about beginners luck.
@jake_runs_the_world3 жыл бұрын
Really useful video
@alexandrevolts75133 жыл бұрын
Wow that's crazy how we do not see the same thing facing the same problem. I coded a Yams last week (Typescript), yeah what a nice coincidence. Concerning the pattern part, I used something like a OOP-oriented way, which is a totally different approach. Basically I just had a class for every possible combination inheriting from a common class "AYamsCombination", and every child class has a common function that I overwrite and that contains the algorithm to "solve" one combination, taking an array of number (the dices) as parameter, and returning the score if it was a valid combination, or -1 if it was a wrong one. Then I store all my classes in an array and loop over them to compute the scores of a given combination. To don't have redundant code I created a "YamsTools" class which contains three functions: hasNDicesOrMore(int[ ] dices, int n), hasSequence(int[ ] dices, int sequenceSize), countDices(int[ ] dices, int dice), which makes that generally every function that is supposed to check a combination doesn't exceed three or four lines.
@Reintjuu3 жыл бұрын
That's what I was thinking. Why is he not taking an OOP approach?
@justcallmenoah57433 жыл бұрын
Yeah, the pattern matching is cool, but the implementation here is prone to bugs. I once made Yahtzee in c++ in college and I found the best way to calculate score, was to have an array of six integers that contain the count of each die value you have. It's much easier to determine your scores that way!
@Roomsaver2 жыл бұрын
Good idea! I like that implementation
@julienderiviere49073 жыл бұрын
Yahtzee was the first game I implemented 20 years ago... in Basic :p I should do it again in C++
@stevefalcigno20923 жыл бұрын
Very nice! One thing, at 33:39 the values 3,4,4,5,6 should give us a small straight (I think).
@erichamion3 жыл бұрын
I haven't gotten to the end, so this may be fixed before the end of the video. "11234" would be a valid small straight, but there's no "?1234" pattern to match it. The same happens if there are two sixes: "34566" needs a "3456?" pattern.
@jasonzurlo15433 жыл бұрын
What about holding and rerolling?
@justinlangley89723 жыл бұрын
I like regular expressions, but only for things where it's implementation stays simple, which is rare. If you can solve it algorithmically, do that instead because other people who read your code will thank you for sparing them if they struggle with regex. Regex is also hard to debug, and requires you to diagram it as a finite state machine (it's how regex works) to figure out where the issue lies. So anyhow, if you want to learn regex you'll want to study finite state machines, and when you build regex yourself you'll want to use a website like regexr (not a fan of it being actions riot based) or some other website. There also exists websites that turn regex into a graph of the finite state machine they represent. Hope this information is helpful for someone who would like to learn regex, but ultimately I don't think it's a critical skill to learn. However, if you come across it in your line of work, you'll at least know what it is and possibly how to dissect it, and then implement a better solution. There are circumstances where a good regex implementation can have a time complexity as good as an algorithmic implementation, and sometimes better if the implementation is poor. I really like the lambda implementation in this video, it's an elegant way to do it.
@THE16THPHANTOM3 жыл бұрын
mkay, this is the way of my thought process as well, so i'm on a good track. minus the clever pattern recognition in code, i can never get all of that in one session. i only get to that point by repeated re-reading my code and discovering the efficient way by accident.
@jimmynuggs56183 жыл бұрын
Welcome back fella.
@iloveyourwcw92653 жыл бұрын
Great video ! : D
@nathanalgren2883 жыл бұрын
Yahtzee kinda reminds me of a Video Poker program I did a while back (interestingly, also in C++). One way I understand the game is basically Poker with dice instead of cards!
@MrFlashPash3 жыл бұрын
How can you write this clean with a graphic tablet
@urbaniuscee36573 жыл бұрын
Nice video. Always good to see std::algorithm and std::numeric used in a creative fasion. One remark though: Wouldn't it be beneficial to immediately return false if one step of the pattern matching fails, instead of using a bool to save to current matching status. That would reduce the amount of variables on the stack, and the algorithm would terminate faster, if the pattern is not matched, which will be the most frequent case?
@Cesar-ey7wu3 жыл бұрын
Yahtzee's core gameplay is evaluating probabilities (which can be surprisingly counter intuitive).
@brianwaltse2813 жыл бұрын
OMG i forgot a vector is a list, and was wondering how he was using a 2d vector to store the data of five dice
@framegrace13 жыл бұрын
I use the same approach. Start with most trivial implementations and the algorithm patterns appear like magic...
@cw3dv3 жыл бұрын
JUST to ask do use cmake or just simple g++
@electronicapentrutoti3 жыл бұрын
Hey, Javidx9. I have a question: Is it possible to create a game such as games that you created with olcConsoleGameEngine, but without olcConsoleGameEngine library, because on my Visual Studio 2019 it doesn't work, and if it's possible to create games without it, can you please make some tutorials? By the way, I like your content and your high quality videos.👍
@javidx93 жыл бұрын
Thanks. The CGE was replaced with the modern olcPixelGameEngine, it does the same thing and is mostly compatible with the videos. You need a library of some description since C++ has no built in awareness of graphics.