-1

注意:4 天前开始 F#,所以请在投反对票之前考虑一下。或者至少让我知道我做错了什么来获得所有的反对票。

情报.fs

module Inteligence
open TTTAiFSharpAlphaBeta
open Boards

type Node(board: Board, moveBox :int, point:int)=
    let mutable _moveBox:int=moveBox
    let mutable _point:int=point
    let mutable _board=new Board(board)
    let mutable _parent= board

    new() = Node(new Board(),0,0)
    new(board: Board)= new Node(new Board(board),0,0)

    member this.MoveBox with get() = _moveBox and set(value) = _moveBox <- value
    member this.Point with get() = _point and set(value) = _point <- value
    member this.Board with get() = _board and set(value) = _board <- value
    member this.Parent with get() = _parent and set(value) = _parent <- value

    member this.Copy(node: Node)= 
             _board<- new Board(node.Board)
             _moveBox<- node.MoveBox
             _point<- node.Point
             _parent<- node.Parent




type Inteligence(board:Board,symbol:int)=
    let mutable _nodeCount=0;
    let mutable _rootNode= new Node(board)
    let mutable _level = 0
    let mutable _symbol = symbol
    let mutable _reff = new Boards.Reffery()

    member this.NodeCount with get() = _nodeCount and set(value) = _nodeCount <- value
    member this.RootNode with get() = _rootNode and set(value) = _rootNode <- value
    member this.Level with get() = _level and set(value) = _level <- value
    member this.Symbol with get() = _symbol and set(value) = _symbol <- value

    member this.Move() :int = 0
    member this.MinMaxAlphaBeta(node:Node, min:bool,  alpha:int,  beta:int):int=0
    member this.BoardPoint(node:Node):int=0

人工智能.fs

    module TTTAiFSharpAlphaBeta
    open AIInterface
    open Boards
    type AI()= 
            let mutable cboard =new Board()
            let mutable level = 0
            let mutable symbol = 0
            interface IAI with
                member this.SetAi (_board: Board ,_level, _symbol)  =
                     cboard <- _board
                     level  <- _level
                     symbol <- _symbol
                member this.GetAiName()="F#AlphaBetaAi"
                member this.GetAiVersion()="0.0.1"
                member this.GetLevel()= [| 3 |];
                member this.AiMove()=
                           Inteligence.Inteligence(cboard,symbol).Move()

问题是我无法访问

Move()

来自 Intelligence.fs

member this.AiMove()=
         Inteligence.Inteligence(cboard,symbol).Move()

在 AI.fs 中

出现错误未定义命名空间或模块“智能”我做错了什么?

4

1 回答 1

2

我猜你正在使用fsi(来自#r)。

如果你是你需要使用

#load "Intelligence.fs"

如果在 Visual Studio 中,您需要确保 Intelligence.fs 在项目列表中的其他文件之前(F# 对编译文件的顺序很敏感)

于 2013-10-03T06:09:52.540 回答