8000 feat: implement a wikiracer by WeetHet · Pull Request #1 · WHForks/WikiGameBonus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: implement a wikiracer #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: implement a wikiracer #1

wants to merge 1 commit into from

Conversation

WeetHet
Copy link
@WeetHet WeetHet commented May 19, 2025

No description provided.

@WeetHet WeetHet closed this May 19, 2025
@WeetHet WeetHet reopened this May 19, 2025
@AndreiIurko AndreiIurko self-requested a review May 20, 2025 07:48
Copy link
@PDDMain PDDMain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to fix your program — it currently produces incorrect results for the input:
https://en.wikipedia.org/wiki/Arithmetic_shift, https://en.wikipedia.org/wiki/Adolf_Hitler
There is a path of 2 pages between them.

You’re welcome to update your solution, and I will update the mark.

The current mark is 4 (maximum is 14).

}

override suspend fun getReferences(page: String): List<String> {
val url = if (page.startsWith("https://")) page else "https://$page"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessarily

@@ -25,8 +27,8 @@ internal class ParsingTest {
fun referencesData() = listOf(
Arguments.of(
"https://en.wikipedia.org/wiki/Kotlin_(programming_language)aaaaa",
emptyList<String>(),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change it? It was correct answer

val searchDepth: Int by option("-d", "--depth", help = "Search depth").int().default(4)
val threads: Int by option("-t", "--threads", help = "Number of threads").int().default(8)

override fun run() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach!

val dispatcher = Dispatchers.IO.limitedParallelism(maxThreads)
val client = HttpClient()

override fun race(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the search method, all arguments are on one line; in the race method, all arguments are on the next line; and in processLevels, each argument is on a separate line. It would be better to follow a consistent formatting style across all methods. Consider configuring a static analyzer to enforce and automate this structure.

}

@OptIn(ExperimentalCoroutinesApi::class)
class AsyncRacer(maxThreads: Int) : WikiRacer {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AsyncRacer class contains two methods that are too large and complex. It would be helpful to break them down into smaller, well-named methods to improve readability and make it easier for others to understand what each part of the code does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0