【发布时间】:2021-10-08 16:38:03
【问题描述】:
这是我目前拥有的
(string -> int list)
let read filename = ....
这是按预期工作的,从文本文件中返回一个整数列表,如下所示:
530070000
600195000
098000060
800600003
400803001
700020006
060000280
000419005
000080079
是的,你是对的,它是一个数独板。这是我必须处理的:
type vertex = int * int (*Cells in the sudoku board*)
type gamma = int (*representing colors 1-9*)
(* [Vertex = Map.Make(Vertex)] *)
module Vertex = Map.Make(struct
type t = vertex
let compare = Stdlib.compare
end)
(* [Gamma = Set.Make(Gamma)] *)
module Gamma = Set.Make(struct
type t = gamma
let compare = Stdlib.compare
end)
伽玛集用于使用图形着色解决数独板。我需要帮助了解如何将整数列表转换为适合此类任务的映射。根据我提供的结构,我可以使用坐标(x,y)访问地图中的每个元素。希望您能理解,否则我将尝试提供更多信息。我真的不擅长 OCaml,但正在努力学习。我很抱歉身体错误等,第一次在这里发帖。
【问题讨论】:
标签: functional-programming ocaml sudoku