const
Forward = 8
Sideward = 1
S = Forward
O = Sideward
N = -S
W = -O
NO = N + O
SO = S + O
NW = N + W
SW = S + W
PawnDirsWhite = [Forward - Sideward, Forward + Sideward, Forward, Forward + Forward]
PawnDirsBlack = [-(Forward - Sideward), -(Forward + Sideward), -Forward, -(Forward + Forward)]
BishopDirs = [NO, SO, NW, SW]
RookDirs = [N, O, S, W]
KnightDirs = [N + NO, N + NW, W + NW, W + SW, O + NO, O + SO, S + SO, S + SW]
KingDirs = [N, O, S, W, NO, SO, NW, SW]
The Array constants is what I really want, they should be visible in the whole module. The const Forward, Sideward are there only to make it more readable, they should not pollute the whole namespace of the module. We have no locale modules in Nim. I may put that code in an separate file and export the arrays only. Not really nice.
You're saying you want to use a local symbol to define a constant global symbol. Does that really make sense?
Yes, you can put your constants into another module, and do not export the private symbols.
Yes, you can put your constants into another module, and do not export the private symbols.
We know that.
Does that really make sense?
Yes. I can write RookDirs = [-8, 1, 8, -1] of course. That avoids the helper constants, but I want to avoid it.