Java Chess Programming Video #22 The Move (Part II)

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

Chess Code Repository :

IDE:

Reading Material:
Рекомендации по теме
Комментарии
Автор

Awesome videos and really helpful, keep it up! Thank you, Amir.

WebForDevs
Автор

Why are you taking the alliance from the move? This way, a piece may (theoretically) change colour when moving...
Passing in the new coordinate would be sufficient.

I'd also recommend to make the Piece class generic:

public abstract class Piece<T extends Piece<T>> {
...
public abstract T movePiece(Move move);
...
}

and the subclasses like

public class Pawn extends Piece<Pawn> {
...
public Pawn movePiece(final Move move) {...}
...
}

Designing your classes like this will enforce you not to change the piece type when moving, as any other return type than Pawn will be rejected by the compiler.

svenlamberti
Автор

Minute 4:01 ->I´m doing the same and IDE just says i need 2 arguments, but doesn´t show me the type.Do i need any kind of plugin to do these or is maybe the version of IntelliJ? Anyone knows? Btw, awesome serie, i´m learning a lot from u.Thnk u very much

oscargm
Автор

Hi there, I have a question. Why did you put the method:

@Override
public Board execute ()

Inside the class:

Public static final class extends Move

I had a few compiler errors saying that the the method execute() doesnt override or implement a method from a supertype. Also, the method:

Public abstract Board execute();

I got errors saying that MajorMove and AttackMove are not abstract, and they dont override or implement the abstract method excute() in Move.

How should I fix these bugs and why do they appear?
Thank you.

edwardtran
Автор

If we are creating a new Piece does that mean right now, if we theoretically play this, it's not really moving it but creating another at that spot? Do we need to delete the old piece or did I miss something?

JohanSebastianCorn
Автор

@Software Architecture & Design
i would build this project without Guava ? can u help me to replace method use it new method do same work ? please answer me

jobiritle
Автор

As a subscriber of your channel and a viewer who enjoys your videos and the cleanliness of your code, I should have tiny, small critique on this application that you are in making. You have made more than 60 videos totaling about 15 hours, and approximately 5 000 lines of code, and in OOP (which is equivalent to 100 000 lines of code in procedure), all of which is, I think, rather an overkill for the problem at hand. Despite it is very brave of you to start such an elaborate project from scratch, I have seen an (even better) chess app, written in 80 lines of source code with (procedural) C++ by a Russian guy. He wrote his code in 3 minutes or so, and the code was much more easy to maintain for the author and to understand for the reader. Regards.

lionpersia
visit shbcf.ru