// // GameModel.swift // mixed_game // // Created by Charles Ciampa on 9/3/24. // import Foundation @Observable class GameModel { /// Contains the current board state as a 2d array. It starts off as None in every spot. This is what is rendered in all the views to represent the board. var board: [Int] = Array(repeating: 0, count: 3) /// Saves the data for the image for the state representation. var imageData: [Int: Data] = [Int: Data]() /// Sets the image representation of a state. /// - Parameters: /// - num: The num to set the image of. /// - data: The data of the image to set it as. func setNumberImage(num: Int, data: Data) { imageData[num] = data } /// Saves the current set of players, to identify who is who in the game. var players: [Player] = [Player(name: "Sam", selection: 1)] func setBoardPiece(num: Int, index: Int) { board[index] = num } func getBoardPiece(index: Int) -> Int { return board[index] } func resetBoard() { self.board = Array(repeating: 0, count: 3) } } struct Player { let name: String let selection: Int static var localName: String = "" }