GithubHelp home page GithubHelp logo

bubblechess's People

Contributors

alexandergmann avatar markkohdev avatar steveacalabro avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bubblechess's Issues

Returning captured pieces in ChessBoard creates impossible downcast

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)

JoinGame

Allow a user to join an existing game that has an open spot

getOpponent

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

Store games in db

GameId
userId1 (white)
userId2 (black)
GameOver

Implemented Board Pieces mask field in superclass (ChessPiece)

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};
}

Return a “result” for checkLogin

“result”: “success” and the “userID” for correct info
“result”:“incorrect password”
“result”:”user” not found” for invalid username

Continue as guest option

This will essentially just create a user with a random username (generate a random 10 char username)
Return “result”:”success” and the userID

Call to updateState() in applyMove() creates infinite loop

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.

Check Login Update

Success and user ID
Password incorrect result="incorrect password"
User not found 'user not found'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.