Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When capturing a sum of cards need to check if there isn't the exact card on the table and in case fail the capturing #33

Open
4 tasks
dbertella opened this issue Dec 23, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dbertella
Copy link
Collaborator

dbertella commented Dec 23, 2020

when a player has a card on his hand eg a king and on the table there is another kind along with a six and a four then the player cannot capture the six and the four but the king should be choose instead.

  • Add server side check that there are no available card to capture on the table
  • if a player play one card and the same card is on the table that must be picked up
  • if there are multiple valid combinations the player must choose between them
  • once we have this checks we can move the ux to be player only play a card on the table then the server responds with:
    a. no capture
    b. capture action (with animation)
    c. intermediate action in which player need to choose between different possible capture solutions and then play the capture
@dbertella dbertella self-assigned this Jan 24, 2021
@dbertella dbertella added the enhancement New feature or request label Jan 24, 2021
@dbertella
Copy link
Collaborator Author

dbertella commented Mar 12, 2021

curtesy of @nkint with this nested for loop we should be able to get all the combinations of cards in order to achieve / validate the above

const array = [0, 1, 2, 3, 4, 5]
let count = 0
for(let i = 0; i< array.length; ++i) {
  for(let j = i + 1; j< array.length; ++j) {
    console.log(i, j)
    count ++
  }
}
const n = array.length
console.log({count, complexity: n * (n -1) / 2})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant