I started a new project in Java recently, but Java really drives me mad, too verbose even with lambdas. And in Java10 they fucked up with 'var' and 'val'. So I switched to Kotlin as I can't avoid JVM anyway. Very happy with the language so far.
It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
import java.io.File
// max recursion level
val maxLevel = 10
// minimum circle size
val maxCircleSize = 5
// restrict check only to users who gave merit less than maxMeritedUsers times
val maxMeritedUsers = 5
val events = File("../merit.txt")
.readLines()
.drop(1)
.map { it.split("\t") }
.map { (_, _, _, userFrom, userTo) -> Pair(userFrom, userTo) }
.groupBy { it.first }
.map { (userFrom, events) -> Pair(userFrom, events.map { it.second }) }
.filter { it.second.size < maxMeritedUsers }
.associate { it.first to it.second }
fun checkCircle(userFrom: String, usersTo: List, circle: List , level: Int) {
if (level >= maxLevel) {
return
}
usersTo.forEach { userTo ->
if (userFrom == userTo) {
println("Circle found: ${circle + userTo}")
} else {
checkCircle(userFrom, events[userTo].orEmpty(), circle + userTo, level + 1)
}
}
}
println("Unique user sent merit: ${events.keys.size}")
events.keys.forEach { userFrom ->
val circle = listOf(userFrom)
checkCircle(userFrom, events[userFrom].orEmpty(), circle, 0)
}