package com.gogame.minesweeper.bean

import com.gogame.minesweeper.DifficultyLevel

data class GameState(
    val grid: Array<Array<CellState>>, // 游戏网格
    val remainingMines: Int,            // 剩余雷数
    val difficulty: DifficultyLevel,      // 难度
    val minutes : Int,
    val seconds : Int,
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as GameState

        if (!grid.contentDeepEquals(other.grid)) return false
        if (remainingMines != other.remainingMines) return false
        if (difficulty != other.difficulty) return false

        return true
    }

    override fun hashCode(): Int {
        var result = grid.contentDeepHashCode()
        result = 31 * result + remainingMines
        result = 31 * result + difficulty.hashCode()
        return result
    }

}
