Question
Java program 1. Create a class Qwirkle with two attributes: colour and shape. 2. The digits 1-6 are used to represent the colours of the
Java program
1. Create a class Qwirkle with two attributes: colour and shape. 2. The digits 1-6 are used to represent the colours of the tile (Red, Green, Blue, Yellow, Orange, Pink). 3. The digits 1-4 are used to represent the shape of the tile (Square, rectangle, oval, triangle). 4. Each object of the class Qwirkle represents one tile to be used in the game. 5. Define a constructor to create object of class Qwirkle with random shape and colour. 6. Define a method to compare two tiles for equality. If a randomly generated Qwirkle object has shape and colour same as an existing tile, generate a new tile. Qwirkle object 1 has colour=green and shape=rectangle Qwirkle object 2 has colour=green and shape=rectangle Then generate new random shape and colour for object 2. 7. Save the class as Qwirkle.java 8. Create a main class QwirklePlay.java. 9. Player 1 picks 3 tiles with random values for colour and shapes. 10. Player 2 picks 3 tiles with random values for colour and shapes. 11. Tiles of player 1 should be unique. 12. Tiles of player 2 should be unique. 13. For player 1 Increment score equal to same-coloured (but unique) tiles. 14. For player 1Increment score equal to same-shaped (but unique) tiles. 15. For player 2 Increment score equal to same-coloured (but unique) tiles. 16. For player 2 Increment score equal to same-shaped (but unique) tiles 17. Display colour and shape of all the tiles of Player 1. 18. Display colour and shape of all the tiles of Player 2. 19. Player with higher score wins. Display Tie if score of both the players is same.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started