Releases: ericmp33/la-brisca-cli
v3.0
In this new release, the main objective was to extract the utility methods and input/output methods from the classes to new ones. Doing that, now I have more classes and packages, but also I reduced the length, clarity and complexity of some of them.
The methods that contain user input, now are all together in the UserInput
class, inside the io
package.
The String
and color utility methods now are inside util
package.
I "static-call" all of them when it's necessary.
I did set the same structure for Catalan and English version, so now there are 2 packages: catalan
and english
, instead of using the root to store the English one and then the Catalan one in a package apart. Also, the App
class, which contains the main method, is in the root not in english
or catalan
packages.
Doing that, I make sure that English version can be run without Catalan one, and back. Before, Catalan version depended on English one.
- Note that in the
App
class, theScanner
from the English version is used. Only in that case, the English version is required.
AI
now extends Bot
. AI
is a type of bot, it's not a record anymore. Now it overrides throwCard()
method from Bot
. With those changes, in the Bot
, AI
and Game
classes is much clearer to see how it works. For example, in the Game
class I create a Human
and, depending on what the user chooses, a Bot
or an AI
. All extend from Player
.
Also, I refactored the code and I made some improvements removing code redundancies and replacing manually written code with calls to JDK
utility methods, which are already pre-programmed, are part of the JDK
and they do the same as my code, but faster and using less resources (I guess).
v2.0
As there is a significant amount of changes, the tag version jumps from 1.x to 2.x, so it alerts that it is not a simple "fixing-bugs release".
The main change in this new release is the game's programming approach. As the program is based in OOP, there was some not-logical thoughts of how the game had to be run. They worked but, with this new release, the game is better, uses less code and is more readable.
There is still a lot to do, but it's a start.
Before:
- I used to have a bunch of boolean variables as not-static fields inside the
Card
class. Accessing them, I could know if aCard
had to be thrown, or if it was taken, etc. - To make a Player take a card from the deck, I had to choose a random card from it.
Now:
- The cards are simply moved to different lists of cards while executing the game. They move from
deck
toinHandCards
and towonCards
. There is no need of having those booleans anymore. - I shuffle them in the constructor, and it just takes the one on top, as in real life.
Also:
I added roundThrown
as a field of Card
, to know in which round the card participates, I improved a couple of methods and modified some comments and I did some other basic stuff.