markkohdev / bubblechess Goto Github PK
View Code? Open in Web Editor NEWRepository for Team BubblePipe for Drexel CS451 Winter '15
Repository for Team BubblePipe for Drexel CS451 Winter '15
On line 84 of ChessBoard.java, there is a bug when trying to cast an arraylist to an array. Explination is in the following FindBugs report:
Bug: Impossible downcast of toArray() result to com.bubblechess.client.BoardPiece[] in com.bubblechess.client.ChessBoard.getCaptured()
This code is casting the result of calling toArray() on a collection to a type more specific than Object[], as in:
String[] getAsArray(Collection<String> c) {
return (String[]) c.toArray();
}
This will usually fail by throwing a ClassCastException. The toArray() of almost all collections return an Object[]. They can't really do anything else, since the Collection object has no reference to the declared generic type of the collection.
The correct way to do get an array of a specific type from a collection is to use c.toArray(new String[]); or c.toArray(new String[c.size()]); (the latter is slightly more efficient).
There is one common/known exception exception to this. The toArray() method of lists returned by Arrays.asList(...) will return a covariantly typed array. For example, Arrays.asArray(new String[] { "a" }).toArray() will return a String []. FindBugs attempts to detect and suppress such cases, but may miss some.
Rank: Scary (5), confidence: High
Pattern: BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY
Type: BC, Category: CORRECTNESS (Correctness)
CheckForMove needs to return a rowFrom, colFrom... style JSON result, as opposed to a move object
Allow a user to join an existing game that has an open spot
All you have to do is check board.endState() which returns true if the game is over (the position is a automatic draw, checkmate, or stalemate) and false otherwise.
Client crashes on GetOpponent because there is no connection close before the value is returned.
Return “username already exists” as “result” if taken
In order to recognize three fold repetition we need to track if the same exact board state is reached three times. This would require us to query the game DB for identical positions and create a property in the board object to track the number of occurrences.
The destination sqaure should be the square directly between the pawn's origin and destination sqaures.
we need a getOpponent method which will spin on the server until the other user joins the game, then returns the username and userID once they have
Store games in db
GameId
userId1 (white)
userId2 (black)
GameOver
CheckForMove in ServerHandler.java should hit the server with "gameID" and "playerNumber," not "gameID" and "user."
If there are no joinable games the game crashes
Check to make sure user isn't created
Severity: Low priority
In the implementation of each BoardPiece, the overridden directional vector (dirs
) masks the vector created in the superclass. These values should be set in the constructor, not the class body.
Before (Queen.java):
protected int[][] dirs = {N,NE,E,SE,S,SW,W,NW};
After (Queen.java):
public Queen(Color col) {
color = col;
dirs = new int[][]{N,NE,E,SE,S,SW,W,NW};
}
“result”: “success” and the “userID” for correct info
“result”:“incorrect password”
“result”:”user” not found” for invalid username
This will essentially just create a user with a random username (generate a random 10 char username)
Return “result”:”success” and the userID
The call to updateState() at the end of applyMove() (line 156) creates an infinite, recursive loop.
updateState() -> hasValidMove() -> getMoves() -> validMove() -> applyMoveCloning() -> applyMove() -> updateState()
When updating the state, hasValidMove is called to make sure the position is not in an end-state such as stalemate or checkmate. This means that we have to generate moves for the opponent, and check to see if at least one is legal. The problem occurs when we find a legal move and apply it to the board, because applyMove will update the state again. This is unnecessary and should be circumvented - once validMove returns true, we are done.
I’m gonna pass in “1” or “2” for userNumber, not “user1”/”user2”
This is a move validation problem.
Does not show the move you made until the opponent makes a move
Success and user ID
Password incorrect result="incorrect password"
User not found 'user not found'
When you promote a pawn it is automatically promoted into a queen. The user should have a choice of which piece to promote the pawn to (Queen, Rook, Knight, or Bishop).
The pawn can move to occupy the squares ahead of it, but the pawn does not threaten those squares.
Change validAttack() so it recognizes this case and returns false.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.