Set

com.phasmidsoftware.number.top.Set
case class Set(cards: Seq[Card])

Represents a set of three cards in the game of Set. A valid Set consists of exactly three cards, where for each attribute (shape, color, number, and shading), the values must either all be the same or all be different across the three cards.

Value parameters

cards

The sequence of three Card objects that make up the set.

Attributes

Constructor

Creates a Set with a specified sequence of three cards. Ensures the sequence contains exactly three cards.

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def attributesMatch(f: Card => Int): Boolean

Checks whether the values of a particular attribute across the three cards are either all the same or all different.

Checks whether the values of a particular attribute across the three cards are either all the same or all different.

Value parameters

f

A lens function that extracts the specific attribute from a card (e.g., shape, color, number, or shading).

Attributes

Returns

true if the values of the specified attribute on the three cards are either all identical or all unique, otherwise false.

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

val color: Card => Int
lazy val isSet: Boolean

Checks if the three cards in the set form a valid Set. A valid Set is formed when, for each attribute (shape, color, number, shading), the values are either all the same or all different across the three cards.

Checks if the three cards in the set form a valid Set. A valid Set is formed when, for each attribute (shape, color, number, shading), the values are either all the same or all different across the three cards.

Attributes

Returns

true if the cards form a valid Set, false otherwise.

val number: Card => Int
val shading: Card => Int
val shape: Card => Int
lazy override val toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.