/* * Copyright (c) 2022, Oleg Kosenkov * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include class Marble final { public: using Point = Gfx::IntPoint; using Color = u8; static constexpr int number_of_colors { 6 }; static constexpr Color empty_cell = NumericLimits::max(); Marble() = default; Marble(Point position, Color color) : m_position { position } , m_color { color } { } bool operator==(Marble const& other) const = default; [[nodiscard]] constexpr Point position() const { return m_position; } [[nodiscard]] constexpr Color color() const { return m_color; } private: Point m_position {}; Color m_color {}; }; namespace AK { template<> struct Traits : public DefaultTraits { static unsigned hash(Marble const& marble) { return Traits::hash(marble.position()); } }; }