Guest User

Untitled

a guest
Apr 24th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. type
  2. TState* = ref object of RootObj
  3.  
  4. Move* = tuple
  5. x: int
  6. y: int
  7.  
  8. ChildState* = ref object of TState
  9.  
  10.  
  11.  
  12. method GetMoves[M](state:TState):seq[M] {.base.} =
  13. quit "to override!"
  14.  
  15.  
  16. # THIS DOESN'T WORK WHEN StarVsNostar is here
  17. proc StarVsNostar*[T,M](state:var T,nill_move:M) =
  18. discard state.GetMoves()
  19.  
  20.  
  21.  
  22.  
  23. method GetMoves*(state: ChildState):seq[Move] {.base.} =
  24. echo "GetMoves - ChildState"
  25.  
  26.  
  27. # BUT IF I MOVE IT HERE, IT WORKS: (uncomment)
  28. # proc StarVsNostar*[T,M](state:var T,nill_move:M) =
  29. # discard state.GetMoves()
  30.  
  31.  
  32.  
  33.  
  34. var state = new ChildState
  35. let nil_move:Move = (-1,-1)
  36. StarVsNostar(state,nil_move)
Advertisement
Add Comment
Please, Sign In to add comment