Coder Social home page Coder Social logo

pokemon's People

Contributors

vartanbeno avatar

Watchers

 avatar

pokemon's Issues

Use ID of a card to play, not its position in your hand/bench

Right now, for example if make a POST request to /Poke/Game/1/Hand/0/Play?version=1, it plays the 1st card in your hand, because we chose 0, and that's the first element in a 0-based index in your hand.

We don't want to go off of a card's position, we want to specify its ID.

Implement evolving Pokemon

When creating a deck, you should also be able to create a card like:

<type> <NAME> <BASIC>
p "Charmeleon" "Charmander"

Implement the Finder pattern for each entity

The TDG will basically be split into a TDG and a finder.

TDG will have the following methods:

  • createTable
  • dropTable
  • insert
  • update
  • delete
  • getMaxId

And the Finder will have all find methods, such as findAll(), findById, etc.

Implement turns in game

/Poke/Game/\\d+/EndTurn, with an appropriate game ID.

When a game first starts, it is the challenger's turn. They start with one card already drawn from their deck.

If a turn ends and a player has more than 7 cards in their hand, the oldest card in their hand moves to the top of their discard pile.

When a player ends their turn:

  • Their turn ends.
  • Player status changes accordingly.
  • The other player draws a card from their deck.

Completely revamp project structure. Use a FrontController, Dispatchers, and Commands

In src/, there should be a FrontController class which extends DispatcherServlet from SoenEA, and in src/app, there should be Dispatcher classes which extend Dispatcher from SoenEA.

The FrontController takes care of the delegation of the request to one of the dispatchers, depending on the path of the request.

Edit:
We could also use SmartDispatcherServlet and SmartDispatcher.

Edit 2:
We should also include Command classes, which extend either Command or ValidatorCommand from SoenEA, in src/dom/command.

Create an IdentityMap for each entity

The identity map design pattern is a means of improving performance by using an in-memory cache to prevent multiple retrievals of the same item from a database.

Example:
The first time we fetch the user with ID 1, we query the database and the User object is stored in the IdentityMap. Every subsequent call to fetch this same user will fetch it directly from the IdentityMap, which stores its objects in a Map.

Make a Global class to store JSP strings

Create a class called Global or something to store Strings that are JSP files. It's better to reference them that, instead of creating new variables every time we want to reference them.

Implement playing energy cards

Playing an energy card attaches it to a Pokemon card that is on the bench. The energy card is removed from the player's hand. It can only be done once per turn.

Implement Optimistic Concurrency Management

Pretty much every endpoint where we manipulate (update/delete) an object should contain its version as a query parameter (?version=[version]).

If we try to update/delete a record and the version we got doesn't match the version that the record currently holds, it most likely means that someone edited it between the time we retrieved it, and the time we sent the info back to the database. In this case, we should get a LostUpdateException.

Retire doesn't need to though. A player should retire from a game regardless of a version, no need to throw a LostUpdateException.

Create turn attribute for Game table, different from version.

turn represents the nth turn in the game; should be incremented after a player ends their turn.
version should be incremented after each state change in a game, i.e. a card play and an end turn.

We'll use the turn attribute to keep track of whether or not a player can play an energy card, since they can only play one per turn. Right now, we use the game version, but since we have to increment it after every state change, it's hard to track.

Implement Data Mappers and Domain Objects

The data previously stored in an RDG will now be in the domain object. The mappers will take parameters from the domain object, and will send instructions to the TDG to execute the desired queries.

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.