Closed ruslankryl closed 5 years ago
If we get 5 cards and consistently swing 3, than call card.throwIn three times we do not get the desired stack — first card3.throwIn return the corerct card to the top of stack, but other calls will return next cards (card2, card1) behind the third
card1 card2 card3 card4 card5
Swinging first 3..
Stack
card4 card5
Trash
card3 card2 card1
Starting throwIn
card3.throwIn(0,0)
card3 card4 card5
card2 card1
Continue throwIn
card2.throwIn(0,0)
card3 card2 card4 card5
card1
card1.throwIn(0,0)
card3 card2 card1 card4 card5
Trash empty
Probably this is a bug of the library Swing I duplicated the ticket https://github.com/gajus/swing/issues/123, but if you have ideas I will be glad. Thanx!
Hi @kryl ! I am sorry for late to reply.
I think, it is a bug of Swing. so I create PR to fix it. check it please. https://github.com/gajus/swing/pull/131
Thanks!
If we get 5 cards and consistently swing 3, than call card.throwIn three times we do not get the desired stack — first card3.throwIn return the corerct card to the top of stack, but other calls will return next cards (card2, card1) behind the third
Steps:
Initial stack
card1 card2 card3 card4 card5
Swinging first 3..
State 1:
Stack
card4 card5
Trash
card3 card2 card1
Starting throwIn
card3.throwIn(0,0)
State 2:
Stack
card3 card4 card5
Trash
card2 card1
Continue throwIn
card2.throwIn(0,0)
State 3:
Stack
card3 card2 card4 card5
Trash
card1
Continue throwIn
card1.throwIn(0,0)
State 4:
Stack
card3 card2 card1 card4 card5
Trash empty
Probably this is a bug of the library Swing I duplicated the ticket https://github.com/gajus/swing/issues/123, but if you have ideas I will be glad. Thanx!