This is a sample application solving the Josephus Problem (https://en.wikipedia.org/wiki/Josephus_problem). The solution uses circular buffer based on mutable ArrayBuffer and index. I have originally used immutable IndexedSeq, but later switched to ArrayBuffer for performance reasons. The application uses Scalatest and scala-logging backed with logback.
The application requires SBT (http://www.scala-sbt.org/) to be installed locally. Run the application from command line or shell:
sbt "run 3 2"
sbt test
- Edit src/main/resources/logback.xml
- Change line <root level="info"> to <root level="debug">
- Run the application and observe logs in console and in josephus-solver.log