Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

From having "zones with cards" to "cards with zones" #122

Merged
merged 14 commits into from
Aug 31, 2018
Merged

From having "zones with cards" to "cards with zones" #122

merged 14 commits into from
Aug 31, 2018

Conversation

Masclins
Copy link
Collaborator

This is the beginning of what will be a huge merge.

The idea behind this is to change the fact that on the backend we had :players with :hand and :rows, both with cards on it. Now we will have a vector :cards with all cards with it, which will have the key :location [] telling us where it is.

This will make it easier to use and pass targets of abilities, which was proving to be pretty complicated.

@Masclins
Copy link
Collaborator Author

On this first pull-request only the backend/src/rules/ had been really changed. We (should) have all tests for that part.
Now I begun working with backend/src/api but a problem appear for which I'd need some help.
For making everything simpler, game-state has :player-ids with the id's of both players. That makes it really messy to create a game with a single player. I actually like not allowing to create a game with a single player, since game-rules don't allow that. Problem is that we'll need to change the api's game-creation logic, and that affects persistence which I don't truly understand.
@kenan-rhoton could you please help me with (or do) that specific part? Idea is that game is created when both players joined, and meanwhile we only have the first player's id and nothing else.

@kenan-rhoton
Copy link
Owner

I can take care of persistence and game creation, since I have acces to your repository anyway 🙃

These changes look awesome, by the way! 😃

(< players-connected 1) {:error messages/lobby-not-created}
:else (let [second-uuid (generators/player-uuid lobby)]
(-> (create-game/new-game
{:player-ids [(first (:player-ids lobby))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost went crazy during the weekend til I realized that I needed to pass the player-ids to the new-game constructor (which is perfectly logical, I might add) instead of putting them by assoc post-construction as with the game-id. In fact, I think the game-idshould also be passed in and added to the game in new-game to ease the logic (everything is done at construction instead of modifying stuff afterwards)

Copy link
Collaborator Author

@Masclins Masclins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests seem great, just got a little comment/doubt.


(defexpect join-game

(let [joined-game (-> (base/create-game) :game-id base/add-player)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use (->? Wouldn't it be more readable not using it?

@kenan-rhoton kenan-rhoton changed the base branch from master to develop August 30, 2018 16:53
@Masclins Masclins merged commit 7232446 into kenan-rhoton:develop Aug 31, 2018
@Masclins Masclins deleted the new-paradigm branch August 31, 2018 08:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants