• Post Reply Bookmark Topic Watch Topic
  • New Topic

Chess endpoint  RSS feed

 
Getulio Miranda
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, I'm building a chess endpoint to a multiplayer chess.

So far I've created a project named chess-core (this is my core API with Pieces, moves, etc...)
also created a chess-rs (this is my endpoint using rs to play games making moves and etc...)
I want to implement a DB and a account system to store games and later on will upgrade the chess-rs to use some UCI engines.

my doubt is the following:

the core should contain all entities and logic to validate a chess move, board representation and so on...
the rs should contain points to create a game, make moves, resign and so on
I'm thinking in put a web project and use Spring to provide a user interface, and manage the DB...

so:

chess-core
chess-rs
chess-web

this is the right design?

I mean the DB calls should be inside web project?
I'm going to call the rs inside from the JSP itself or should I use it inside my controller (business layer) on the web project?

Thanks
 
Stephan van Hulst
Saloon Keeper
Posts: 6981
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really see how the chess-rs module would be different from the chess-web module.

The web module can expose a REST API using annotations on controllers. It can have a dependency on your core or some other chess engine that perform the game logic, and can persist the game state in a DB between requests.
 
Getulio Miranda
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, makes sense,but I want to provide an endpoint so I can reuse my core in a .NET implementation.
Actually at this very first moment I want to provide a REST service that can be used by other developers to implement their own chess platform, and of course I will provide mine too... how should I design the project, any ideas?
 
Stephan van Hulst
Saloon Keeper
Posts: 6981
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The web module provides the endpoint. I'm not sure why you need a separate module for it, or what you would put inside it.

Please describe what you imagine would be inside the chess-rs module.
 
Getulio Miranda
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, sounds confusing, let me explain, we are promoting a internal hacking contest (1 month long), with some .NET, Java and PHP developers so we want to provide an endpoint like an API to handle the game logic, so in the REST we should evaluate moves, checkmates and etc... and return a JSON with the board and the validations, of course to consume it the caller should pass all the pertinent attributes to the REST. With that in mind I want to provide an Java implementation of a multiplayer chess platform using the API provided though REST.

So the big doubt is, should I call the REST from my controller inside my web project acting like a proxy, I know that would be not performance centric but it doesn't matter, since the API provide a list of possibles moves that I can use to validate the move provided eagerly before submit another call.
 
Stephan van Hulst
Saloon Keeper
Posts: 6981
110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you access the REST API from your web application? Your web application should *provide* the REST API. The web application (written in Java) then talks directly to your core or chess engine.

Your clients (written in any language) then access the REST API (probably using HTTP requests). These requests will automatically be converted to controller method calls by your Servlet container.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!