module SimpleCrop using Persefone: FarmPlot, Length, m, SimulationModel, initfields_fill_with! import Persefone: stepagent!, croptype, cropname, cropheight struct CropType name::String end cropname(ct::CropType) = ct.name mutable struct CropState croptype::CropType cropheight::Length{Float64} end croptype(cs::CropState) = cs.croptype cropname(cs::CropState) = cropname(croptype(cs)) cropheight(cs::CropState) = cs.height """ stepagent!(farmplot, model) Update a farm plot by one day. """ function stepagent!(farmplot::FarmPlot{CropState}, model::SimulationModel) # TODO: do something simple end """ initfields!(model) Initialise the model with its farm plots. """ function initfields!(model::SimulationModel) initfields_fill_with!(model) do model, x, y FarmPlot(length(model.farmplots) + 1, [(x,y)], CropState(model.crops["natural grass"], 0.0m)) end end end # module SimpleCrop