At 4:30 AM you are making this content.I can't thank you enough for your excellent content.You deserve way more subscribers than you currently have as these are the best Low level design videos I have come across on KZbin. THANK YOU!
@lakshaysharma81442 жыл бұрын
In short video you explained exactly what is needed love your content.
@tusharkuwar42 жыл бұрын
I am chess player. And there was high chance this question could come in interview. Thanks a lot !! 😅
@rajugaurav50524 жыл бұрын
Such an awesome content, I wish KZbin has recommended this a few months back. Kudos @Soumyajit 😅😀👍🤘✌️🙏💯👌👏
@ayushjindal49814 жыл бұрын
I have never seen a video this much crisp and clear. Thanks.
@SoumyajitBhattacharyay4 жыл бұрын
Thanks for the feedback. Please do share amaong your friends!!
@rahulsharma50304 жыл бұрын
1. The piece should have status to tell whether is alive or dead. 2. The move function in piece, will just be able to check whether it is a valid move.But we also need to make sure that in moving piece from one location to another, it should actually be checking whether there is no another piece in that move.So piece needs a board also as input
@SoumyajitBhattacharyay4 жыл бұрын
1) yes it is a good point. Piece can have a status Enum that will tell us the status of that particular piece. 2) No not at all. Whether or not another piece is there can be directly validated inside the Chess class itself as it is where the playermove function will be called. I contains the chess board and can deduce from here, Piece should not t all hold any information of the chess board as it is not the responsibility of a single piece to know about the entire board.
@rahulsharma50304 жыл бұрын
@@SoumyajitBhattacharyay I am saying, let us say that i am a player and i want to move some piece ,say queen from location a to location b, the canMove in piece will just check whether i am allowed to move or not.Now let us say that the destination location is valid.But while moving from source to destination,in path path,their is some other piece also.In chess we cannot cross other pieces.How will canMove verify this without knowing the board configuration?The chess game cannot verify this as it does not know what path the piece follows from source to destination.
@SoumyajitBhattacharyay4 жыл бұрын
The chess game can verify this as the move request will be originating from there it self and it will contain both the src and destination location along with the board information.
@rahulsharma50304 жыл бұрын
@@SoumyajitBhattacharyay yes but each piece can have its own way of path from source to destination.Like knight will go its own way, king its own,bishop its own, only piece can tell what is the path from source to destination.going from a to b will differ piece by piece.I think i am not able to explain you:(
@SoumyajitBhattacharyay4 жыл бұрын
All the path move in straight lines between source and destination, except for knight which can hop over pieces. So for knight only destination validation is ok. So the chess game can decide on the same. How i am envisioning is, the possible path will tell us the possivle moves from the source. It will return the list to chess. Chess will validate the same using board and return on the viable options on screen. User will only be able to move uptil the viable options that are present on screen for the selected piece.
@Rakeshkumar-po2yg2 жыл бұрын
Thanjyou Soumyajit. you made it easy for us..
@Adi-jr4xf2 жыл бұрын
brilliant this is the best lld content out there!!!!!
@RajatBhardwajBEE4 жыл бұрын
Thank you so much! Please keep making more of such LLD videos. One I wanted was to design backend of Snake game that was there in the Nokia phone and Parking lot. Thanks again.
@SoumyajitBhattacharyay4 жыл бұрын
Sure i will definitely make such videos! Duly noted.
@SoumyajitBhattacharyay4 жыл бұрын
Hi the parking lot video is out!!
@RajatBhardwajBEE4 жыл бұрын
@@SoumyajitBhattacharyay Thank you so much for your time. A much needed video.
@pankajsaini23766 ай бұрын
@@SoumyajitBhattacharyay You are amazing, love your content. Can you make a video on Google Doc and Car Rental System
@kaushikg19963 жыл бұрын
Underrated channel, awesome content❤
@ayushchoudhury17002 жыл бұрын
Got asked this in interview a few days back. Couldn't elaborate a good design and got rejected. Wish I had seen this video before 😦
@tsjoshi3 жыл бұрын
Awesome video !!! One thing, How are we handling checks ? In case of check, how can the game enforce other player to play limited moves only ?
@techshala89294 жыл бұрын
It was an awesome video dude!! keep uploading more such content!!
@user-xo3mi4jx5g2 жыл бұрын
Thank you so much. This was extremely helpful!
@SoumyajitBhattacharyay2 жыл бұрын
No problem at all 😊
@gopikrishnaks96645 ай бұрын
Thank you so much for the efforts. Had a doubt, could you please check? This solution is very impressive but I couldn't find any direct application of design patterns. Interviewers don't always expect that and it needs to be applied only if it's needed right?
@AamEngineer4 жыл бұрын
Fantastic video it was... Thanks for making and explaining the low-level designing in a very neat and clear way... (Y)
@SoumyajitBhattacharyay4 жыл бұрын
Thanks for the feedback!!
@HimanshuKumar-xz5tk Жыл бұрын
Really appreciate the content Request you to include UML diagram before coding
@indrakumarreddy66793 жыл бұрын
Very clear Explanation, Thanks for the video. Could you please upload low level design for Snake&LadderGame
@creatingwaves4 жыл бұрын
Amazing video. Thanks a lot!! Please make a video on parking lot problem and car rental like uber.
@SoumyajitBhattacharyay4 жыл бұрын
Sure i will make them. Thanks for the input!!
@SoumyajitBhattacharyay4 жыл бұрын
Hey the parking lot video is up!!
@princekm59023 жыл бұрын
Very nice design.One doubt is how you update cell list,ie, when a player moves a piece. meaning while creating a move, We have to find the particular cell by cell position by performing a linear search right?
@msingla1352 жыл бұрын
why can't you use the index directly on the List to get the cell?
@abhirupacharya010 Жыл бұрын
Beautiful explanation.
@ujeshnada51412 жыл бұрын
Is it enough for the Chess board LLD question? Don't we have to define the move methods of all the pieces ?
@RaunakShrivastava3 жыл бұрын
Why do we need a separate class 'Move'?
@rahulsharma50304 жыл бұрын
hey,i already mentioned is below long thread one doubt regarding how will we check whether the movement of piece from one location to another should not cross any chess piece in its way.the u have written it, you will have to do lot of ifelse in playerMove fxn in chess class which is not a good thing.so u should pass board instance to the piece, because it makes more sense, instead of asking board to give me you move,we will ask,given this configuration what are your moves as moves are defined with respect to board configuration.
@mohammadkaif81433 жыл бұрын
How will i get to know whether the piece is rook or queen or king etc?? It has only color and api defined.
@rahulsharma50303 жыл бұрын
@@mohammadkaif8143 why do you want to know that?
@AkshayKumar-fj9hd3 жыл бұрын
We need to know type of piece only to identify if the move we are trying to make is valid or not, or to identify the next possible moves. If you see piece is an abstract class, and all the individual piece classes are defining validate and possibleMoves methods in their implementation. And we always pass the specific implementation of abstract class/interface. So e.g. in case of Move class it will have the specific peace object (e.g. rook, king etc). So only specific validate method will get called. I hope I didn't make it more complicated for you :)
@pawandeepchor893 жыл бұрын
You are really awesome, please continue sharing the knowledge 👍👍
@aianaverma40252 жыл бұрын
Awesome explanation
@sibendusankardas35322 жыл бұрын
How would we catch the checkmate scenario ? Or the king swap position with rook scenario.
@rahulsharma50304 жыл бұрын
Nice. I think Piece should have only canMove method to valiadate whether it can move or not.But the actual move should be done by chessGame. Game should be able to check Piece.canMove(), and if yes, game should be responsible for moving piece. What will piece do with move method?If you put Move in piece in Piece ,it will eventually call chess to move which is not a good flow.Let me know your thoughts?
@SoumyajitBhattacharyay4 жыл бұрын
No. Here the move method will actually contain the move defination for the piece. Move is piece dependent and chess does not have move a piece has a move and player plays the chess game by using the pieces move. Hence, chess should not have move. Individual piece should have it.
@SoumyajitBhattacharyay4 жыл бұрын
The best way to understand is to know the has a relationship between the methods and the corresponding classes.
@rahulsharma50304 жыл бұрын
@@SoumyajitBhattacharyay, then piece needs to know board information also.Will it be a parameter in Piece.move method?As of now i cannot see it?Board update should be done by chess i guess and not piece.If we maintain board information with piece or pass as a parameter,it does not look correct.Let me know you thoughts?
@SoumyajitBhattacharyay4 жыл бұрын
No that is not the case. See the move method in piece has a boolean return type. After the player tries to move a piece, the update board method in the ChessBoard is called. It will internally call the piece.move method that will return either true or false. Based on the return, the board will be updated. The piece should not know board information. That should never happen. As board has pieces and not the other way round. The best way is to understand these relationships between different class and then try and formulate what should be under which class.
@rahulsharma50304 жыл бұрын
Thats what i said.But in your code we have both validate and move method,which looks like validate method will do validation whether this move is allowed is not and move method will actually move the piece.But if move method will return boolean and based on that board will be updated,then what is difference between move and validate method?Arent they do same stuff?
@carpediem94074 жыл бұрын
i am a chess player ... just loved the way you made low level design of chess .. 💯💯
@SoumyajitBhattacharyay4 жыл бұрын
Thanks for the feedback! Really apprciate it 😄
@abhishekkapoor7955 Жыл бұрын
why we have move function inside piece, what will be the logic of this function. Piece is not maintaining its current position then Chess class has move() already
@AnandKumar-nx1ke3 жыл бұрын
The question i would like to ask. Are LLD interviews of different kinds too : Like in some only Class Diagram is asked. In Some only skeleton(Like your video ) is asked. In Some complete running code is asked. Is my assumption correct. or only the 3rd one is asked at every LLD ?
@shubhampal78772 жыл бұрын
3rd one is called machine coding
@harenderbhardwaj63572 жыл бұрын
Hi brother, I am starting with LDL now. Can you please guide me. How should i proceed?
@shubhampal78772 жыл бұрын
First check what you are going to learn, it's LLD not LDL
@vimalvestron86843 жыл бұрын
Bro if we make Piece interface instead of Abstract class that would also fit in , any particular reason you went with abstract class in this case ?
@princivershwal3 жыл бұрын
I also need answer for this.
@niteshnikhare15623 жыл бұрын
There may be certain methods that may have common implementation irrespective of Piece for e.g. Say Move(Location a, Location b, Piece), this method can be kept common and I know there should be some validation in the method checking if the move is valid or not for that we can create an abstract method and implement it in all the pieces which will give you all the possible moves for a particular piece from that particular cell location. Once validated, you can just move the piece to the target location. The move is common irrespective of piece type so can be implemented in the main abstract piece class itself, it will save a lot of code duplicacy.
@rahatsaini11892 жыл бұрын
Hey What if we want to change the colors of the chessboard to something else or may be user-defined.
@SaurabhGupta-iu4sy3 жыл бұрын
Hi @Soumyajit Bhattacharyay, why there are no Identifiers for the Game, Player, Board and Pieces classes? Are you assuming that this is a desktop application supporting only one game at a given time? If it had been an online application, with multiple games being played at a time, we will have to keep the unique identifiers in these classes, right? Can we implement the online chess app somehow with no datastore/database behind it?
@SoumyajitBhattacharyay3 жыл бұрын
Again, in all of the lld it is given from an interviewing perspective, where it is expected to do everything in memory be it lld round or machine coding round. For most actual use cases, you would require some form of data store. Yes this is from a perspective of an actual chess game. If you complete the video, I have discussed that as a task we should extend this design for an online chess playing service like chess.com etc.
@SaurabhGupta-iu4sy3 жыл бұрын
@@SoumyajitBhattacharyay Thanks, say if we had to do this for online application with multiple games being played, how would we maintain the data corresponding to a particular game in the RAM (which datastructure or in-memory data modelling to use?), so when request comes we can know the state of pieces, players, currentTurn and board? Any insights would be helpful, as this was a real question asked in interview.
@msingla1352 жыл бұрын
@@SaurabhGupta-iu4sy Each game must be represented by a game id. So we can store the state of the relevant objects (like board, players(IDs should be enough), current turn, etc) in a KV store (E.g. MongoDB) in form of key=game id, value=JSON object which has serialised board object and other mentioned fields. So next time if the same gameid is loaded, we'll get the exact status of the game where the game was abandoned. Hope that makes sense.
@poojagoyal35743 жыл бұрын
hi Soumyajit. would like to appreciate you for the content that you upload. could you please suggest any site/link which can help me to improve my skills on LLD.
@sakshambadaya4574 Жыл бұрын
Can u also provide the information of database table and schema to be used while designing as this is also asked most of the time
@hemantagrawal253 жыл бұрын
Tell us about the design pattern in each LLD video. so we can understand which design pattern use in LLD
@helperclass2 жыл бұрын
very nice. thanks
@gautammalhotra6543 жыл бұрын
How will you implement move method in Piece extensions?
@anirbansaha79873 жыл бұрын
@Soumyajit : Why do we need the move class ?
@AkshayKumar-fj9hd3 жыл бұрын
In my opinion because a move has some information associated with it. E.g. when a player will make a move, then Chess classes's playerMove API will be called, that will internally call ChessBoard classes's updateBoard method. Now updateBoard method will require some information regarding the move e.g. startPosition, endPosition, Player etc. One way is to pass all this in diff variables or pass everything in a single object i.e. Move class in this case.
@HarshalDev9 ай бұрын
why dont you make class attributes private, public or protected?
@DeepanshuGabba3 жыл бұрын
Can you please tell if multiple players (for example 3 players A, B and C) are trying to enter in a chess game at a same time , then how will we decide that which 2 players should our game select and which one of them will be left out?
@msingla1352 жыл бұрын
Use synchonized to "write" players to the players array and decide on FCFS basis.
@lal_14046 ай бұрын
excellent
@manishdadheech84404 жыл бұрын
Hi Soumyajit very nice explanation but I have a small doubt. Can interviewer ask the candidate to write code for any method in LLD or full coding? Should we ready for that also?
@SoumyajitBhattacharyay4 жыл бұрын
Yes it can be. In my media .net interview i was asked to write entire working code for the LLD and then run the code on a compiler and every requirement should be working there. It was an amazing experience. You can find the video here along with the question kzbin.info/www/bejne/a4KXhaiFra-Ya5Y But mostly it will be class level and api / db design. Sometimes depending on the company they might ask you to implement all or some part of it.
@SonGoku-lc1sb3 жыл бұрын
Hey Soumyajit , can we use python for LLDs ? I see most of the types people use java. But at amazon is it ok if folks do it in python ?
@HimanshuKumar-xz5tk Жыл бұрын
yeah bro, it does not matter Use any OOPs language unless its for a specific role (eg: go developer)
@shasha65384 жыл бұрын
How will you implement makeMove
@gautammalhotra6543 жыл бұрын
+1
@inkclusiveDesign3 жыл бұрын
Game_Status class can have another status that's "Stalemate".
@abhid153 жыл бұрын
I'm sorry but I do not see the source code link. Can you please share it? Great video.
@SoumyajitBhattacharyay3 жыл бұрын
It is present in the description. Does that link not work?