http://pastebin.com/KTCkMu1p
A total of 4 cards including cards [img_0] turned upside down and images [img_s1-s3] with 3 different designs.
Display 6 cards turned upside down on the screen and clear after 3 consecutive different designs
Game over
if you put out the same design by the third time.
I would like to create an app that says that it is currently clogged up t
How should I write about nesting if?
Please teach me.
I don't know Java, so this is a general coding method.
You can make a decision by combining many if statements, but I think it's better to prepare a function like this that abstracts the judgment logic.
boolean Overlapping cards (list of cards previously flipped, new cards) {
for {
if (card == new flipped card) return true;
}
return false;
}
Also, every time you flip a new card,
1. Call the Overlapping Card Function
2. Add a flipped card to the
List of cards you have flipped so far
You should repeat this process.
No matter how many pages you flip, you can just call this function.
You may be able to use the contents().
No matter how many cards you have or how many times you flip, you can handle them.
ArrayList<Cards>cards=newArrayList<>();
// The card was flipped over.
if(cards.contains)) {
// the same design (have been turned over in the past)
} else{
// Different designs (for the first time
cards.add; // keep added
}
© 2024 OneMinuteCode. All rights reserved.