0

I'm taking Michael Genesereth's General Game Playing (GGP) Coursera course. In GGP a player is allowed a fixed amount of time to make a move. I'm writing my players in Scala. (The underlying GGP codebase is Java.) Does Scala provide any support (or are there any Scala libraries) that can be used to help ensure that a computation will respond in a given time.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
RussAbbott
  • 2,660
  • 4
  • 24
  • 37

1 Answers1

3

You can use Futures and get the result with Await.result(future, duration) or one of approaches in Scala Futures - built in timeout?.

Community
  • 1
  • 1
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • I now see that another option is to use Actors and their [`context.setReceiveTimeout` method](http://doc.akka.io/docs/akka/snapshot/scala/actors.html). – RussAbbott May 01 '14 at 06:17