While checking out the code examples on XE5, I noticed there are a lot of examples using re and hardcoding the patterns the tester will use
Some examples even appear to be legit, with actual logic, but then they just degrade into hardcoding the patterns and leveraging re.match.
Is that something you guys could clean up? Itās a bit frustrating to try and compare my solution to others and find out that there were a bunch of cheats.
This probably happens in earlier stages, but I didnāt check.
Hey @eaverdeja, thanks for highlighting the issue!
Weāve also noticed this and have implemented an anti-cheat mechanism to detect solutions that probably rely on built-in regex features:
That said, we havenāt yet cleaned up older submissions that slipped through. Weāll likely address this when trying to remove submissions that no longer pass the latest tests.
Iād like to see other legit code examples because I noticed my code got quite messy as the test cases started combining things like quantifiers, character classes, alternation, backreferences etc.
I was curious as to how others tackled this complexity, thatās why Iām coming here with this clean up ask
Iām not sure why you have two competing implementations? But I wouldnāt consider that cheating - you are processing the pattern into something more manageable so your program can handle it.
What I mean by cheats are solutions that hardcode the input text and pattern the tester sends, just to pass the tests. There are quite a lot of these on code examples for later stages (talking about python specifically).
Quick update here - we took a closer look at this, and these arenāt cases that would trigger anti-cheat. Anti-cheat invokes patterns that users are unlikely to have handled (quantifiers are what we use I think), and checks if the answers are correct. Since these solutions are hardcoding patterns, the anti-cheat case doesnāt trigger ā it still fails on āunknownā patterns.
We already have a mechanism to filter these kind of solutions out when displaying āConcise code examplesā (more on that here: "Concise" code examples) ā it looks like this wasnāt properly configured for the 3 stages in backreferences. Weāre fixing this! For xe5 & Python specifically, this should already be fixed. The concise examples at the top should now not be the kind that use re.
Weāll backpropagate this to other stages shortly!
Ah, okay, I didnāt see any hardcoded solution. Honestly, thereās no reason to implement two solutions. In fact, I implemented them as two independent modules. I started using the standard library, but since CodeCrafters included lark and pyparsing, I tried replicating the same thing to see if it offered any advantage and thinking that maybe more people would use it s to compare my code.