joshuaauerbachwatson / anyCards

Multi-person card game with no built-in rules
Apache License 2.0
0 stars 0 forks source link

[client] Enforce restrictions on GridBox behaviors, including ownership #23

Closed joshuaauerbachwatson closed 1 year ago

joshuaauerbachwatson commented 1 year ago

There was originally just one kind of GridBox. In introducing the most recent changes for issue #20 I elaborated this into three kinds of GridBoxes called .Deck, .Discard, and .General.

A .General box behaves like GridBoxes did before. You can add and remove cards freely. Face up cards are placed on top and face down cards on the bottom. A GridBox created via a long press is .General by default but you can change its kind in the initial menu or subsequently.

A .Deck box has all of its cards face down and does not allow additional cards to be added. The top card may not be flipped over in place but it may be dragged off the pile, after which it is like any card. The initial deck created during game setup has this characteristic.

A .Discard box has all of its cards face up and does not permit cards to be removed. Cards may be added but they are always turned face up and added at the top of the pile.

In implementing this, I managed to enforce some of these rules and not others. The present issue is about completing the enforcement. It also should cover a new idea, which is that GridBoxes may be "owned." The original creator of a GridBox may optionally become its owner (otherwise it is unowned). A owned GridBox cannot be modified in any way by a player that isn't its owner.

joshuaauerbachwatson commented 1 year ago

Note: I believe there are "meld" games in which the top card of the discard pile is removable. With the current plan, this would require declaring a general box rather than a discard box. To be revisited as needed.

joshuaauerbachwatson commented 1 year ago

This is basically done now. Might have to be revisited as I gain more experience playing actual games.