I think I've located the cause of the issue.

The constants
    
    
    const WALL                                     : string = twHat
    const PATH                                     : string = twPeriod
    const EAST                                     : string = twLAngle
    const WEST                                     : string = twRAngle
    const NORTH                                    : string = twHat
    const SOUTH                                    : string = "v"
    
    
    Run

are used in a single location to convert strings to set of x,y coordinates.

the problem test data set is
    
    
    #E######
    #>>.<^<#
    #.<..<<#
    #>v.><>#
    #<^v^^>#
    ######.#
    
    
    Run

myData is a seq of strings representing the above dataset this dataset is 
converted to sets of x,y coordinates using
    
    
    s.FinalXY = (myData.first.find(twHash),myData.low)
        s.Current = (myData.last.find(twHash),myData.high)
        
        for myRow in s.MinRow..s.MaxRow:
            for myCol in s.MinCol..s.MaxCol:
    ****            let myChar: char =  $mydata[myRow][myCol] *****
                case myChar
                    of WALL:
                        s.Wall.add((myCol, myRow))
                    of NORTH:
                        s.NorthB.add((myCol, myRow))
                    of SOUTH:
                        s.SouthB.add((myCol, myRow))
                    of WEST:
                        s.WestB.add((myCol, myRow))
                    of EAST:
                        s.EastB.add((myCol, myRow))
                    else:
                        discard
    
    
    Run

the line highlighted with **** had been giving me an error at the [mycol] when 
myChar was defined as string, so I'd changeed it to char which leads to a 
mismatch between the constant declarations and the case variable. type.

changing
    
    
    let myChar: char =  mydata[myRow][myCol]
    
    
    Run

to
    
    
    let myChar: string =  $mydata[myRow][myCol]
    
    
    Run

resolves the problem with twHash but now leaves me with an error of '
    
    
    C:\Users\xxxxx\source\repos\AdventOfCode\Nim\AoCLib\src\chars.nim(20, 45) 
Error: duplicate case label
    
    
    Run

which is the line
    
    
    const twHat                  : string = "^"
    
    
    Run

If I rewrite the case statement using the tw strings directly
    
    
        for myRow in s.MinRow..s.MaxRow:
            for myCol in s.MinCol..s.MaxCol:
                let myChar: string =  $mydata[myRow][myCol]
                case myChar
                    of twHash:
                        s.Wall.add((myCol, myRow))
                    of twHat:
                        s.NorthB.add((myCol, myRow))
                    of "v":
                        s.SouthB.add((myCol, myRow))
                    of twLAngle:
                        s.WestB.add((myCol, myRow))
                    of twRAngle:
                        s.EastB.add((myCol, myRow))
                    else:
                        discard
    
    
    Run

All errors go away and I get a successful compile.

Reply via email to