Giter VIP home page Giter VIP logo

Comments (27)

phikal avatar phikal commented on May 30, 2024 1

@wilyarti Those are two concepts which would would be very fit for their own game modes. I've been thinking about some code-reorganisation recently, so I will try to think about those when doing that. Especially the first sounds interesting...

from regex.

phikal avatar phikal commented on May 30, 2024

What level are you on? It get's harder later on, but if you think that it stays the same, I could change the score algorithm to maybe look at the past strategies and give you less points if you used it too often, leading to the level lowering itself.

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

I mean that now the optimal strategy in most cases is such:
1 create a regex [^]+
2 enumerate words
3 enumerate chars in each word, put them into list, tag each char with the word where it is present
4 check wheither the char is present in words from the left side, if it is exclude it from the list
5 sort chars by the count of words they are present in
6 take the minimal subset of chars present in all words from the right side
7 put them into regex before the last square bracket
For example if we have
Jfnd jemx
,rpcn djnr
Ufkz hxne
the winning regex will be [^je]+

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

There is an easy way to distract this strategy: make sure that all the chars from the right are present in the left.

from regex.

phikal avatar phikal commented on May 30, 2024

I wouldn't want to totally eliminate the strategy, but giving the player less chances to use it seems good enough. This could be done by having less characters on the right side than on the right. Adding to that the history-based points (maybe even negative point), it could be work out well.

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

The fact is that it is best, it seems that it gives the shortest regex. So I think that since some difficulcy (not far from the beginning, maybe after 5 puzzles) the probability that the puzzle is solvable using this strategy should be negligible to make user use another one. Also the difficulcy raises too slowly, the rate should be increased not to make the game boring.

from regex.

phikal avatar phikal commented on May 30, 2024

I still don't really want to exclude a possibility totally, but I agree that future versions should make it harder to use. Excluding it would oppose the idea I had for the game, declaring a few functions and algorithms that describe the whole game. You see, it's more of a proof of concept, than an entertainment spectacle.

Regarding the difficulty, the current level generation can be found here:

diff = (int) Math.round(1.2*Math.sqrt((prefs.getInt(SCORE, 0) + score * 1.1 + 1) / (game + 1)));

I am still optimizing the function to not grow too slowly. I may also have to modify the points calculation too:

 return Math.round(((max - len)/2+1) * (1 / ((Math.abs(right - wrong) + 1)) + 3 * calcVal(regex)));

Any suggestions are appreciated.

from regex.

 avatar commented on May 30, 2024

Hello,

I really like the idea of the game but I ran in the same trouble then KOLANICH (played only until level 9). It's not that hard to solve the puzzles.

And I would like to have more "real life" problems, like matching a certain URL and another one not (or maybe even subsetting, backward references, etc.) or matching a certain words in a sentence and so on. I know this is hard to randomize or auto generate but would make the game much more interesting.

However, nice idea! ;-)

from regex.

phikal avatar phikal commented on May 30, 2024

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

Hmm, look at http://regexcrossword.com and https://regex.alf.nu/

from regex.

phikal avatar phikal commented on May 30, 2024

First of all I appologize for not fixing the issues earlier - I didn't have access to a computer with all the tool necessary, so I had to wait until I got home from my holidays.

Regarding the cheats like [^xzy]* or the qwe|rty|yui cheat mentioned in #4: after testing it I have realized that you can't actually level up past lvl 6-8 (approx.). To go beyond these levels you have to use more complex regular expressions to get at least +100 points (my high score was +225, maybe that should be in statistics too). I'm not saying that the specific numbers from the calculation should not be changed, but in itself it creates the game I intend it to be. The sqrt method lets the game go on forever while getting harder all the time. If you can't (or don't want to) solve a puzzle, you can use the hacks from above - but with the risk of maybe losing a level (can happen, especially after lvl. 11). All in all it seems fine for now - especially with the pop up implemented from #9. From my point of view I believe the issue can be closed, and I hope nobody had too much of a problem with it.

and to @KOLANICH's last message: http://regexcrossword.com is completely the opposite, while https://regex.alf.nu/ seems to have a set number of rounds. Both games are static and finite, while ReGeX is dynamic and infinite. regex.alf (f.e.) has the benefit of never having bad rounds, while ReGeX may have good or bad rounds by chance. I don't want my game to just be a clone, it it's not intended to be.

from regex.

phikal avatar phikal commented on May 30, 2024

I forgot about this, but this issue should be reopened with #18. I am about to finish implementing game modes and a mode to contribute to the database, in order to get @bastorran's "real world" problems.

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

What is redb? I'm unable to connect to http://redb.uk

from regex.

phikal avatar phikal commented on May 30, 2024

@KOLANICH I still haven't published v1.2, because I'm still working on REDB.

REDB (Regular Expression Database) is a concept suggested in #18, and it will basically be a site on http://redb.uk (I'm planning to buy that domain or a similar one) , where people can suggest, vote on Tasks for ReGeX and can look into suggested results. I hope it will integrate the real world problems mentioned before in this thread. ---> The site is still not up, so the REDB game mode isn't functioning yet.

If you want to test it, uncompress this archive, use python -m SimpleHTTPServer in the resulting directory and configure the REDB server to request from the local address you're hosting on.

from regex.

oleastre avatar oleastre commented on May 30, 2024

As I also started using your nice app, I quickly come to the conclusion that by simply excluding some characters it's easy to solve.
A simple idea I had this morning is why not take the problem in the other way around: generate a random regex and from there generate a list of matching string (with a max regex length).
For inverse regex, there are already some existing libs:
https://github.com/mifmif/Generex
https://github.com/bluezio/xeger

from regex.

phikal avatar phikal commented on May 30, 2024

@oleastre great idea, but I see two problems:

  1. I'd have to write a random ReGeX generator.
  2. How do I generate strings that don't match.

I just woke up, so I'm not in top logical problem solving shape, but I presume both would be possible (why shouldn't they be? efficiency would be the first problem). Other than that, I really like the idea, I already have a RandomGenerator class somewhere, and all I'd have to do is rewrite it. The procedure the generator uses could also be added as a option in the game mode settings (Classic vs Reverse). But for now, I believe that should be a task for 1.3 - not taking personal stuff into account - I still haven't finished the REDB server, which I want to be the main feature of the 1.2 release. But I'm certainly going to look into it.

Edit [18/11/15]: Potentially solving problems 1. & 2.: What if I randomly generate the "match" string like I'm used to, then create a ReGeX that matches all of those (I know there's some perl libary for that - so I'd guess there's a java one too), then use Generex and generate strings with the negated regular expression ((?!...)). Might or might not work, as I said, I just woke up.

from regex.

oleastre avatar oleastre commented on May 30, 2024

It's just an idea, and I have not tried to overcome all logical problem before posting.

Of course it's not an easy task to get it working, but it can probably be used to generate more challenging problems (for advanced difficulty levels ?).

Generating random regex should not be a real problem; I think about constructing a random tree structure to model repetitions, character class matching and sub patterns.

Generating non matching strings could be done by creating another regex that negates some of the properties of the original one (inverse character class, replace a number of repetitions, ...). If the initial regex if created using a tree structure, it could be done by replacing some of the tree nodes (or even have some node types that can return an inverted regex part).

If I find some time to do a POC, I will try to send you some code, and it can of course wait for later version of the game.

from regex.

Zamubafoo avatar Zamubafoo commented on May 30, 2024

To extend this issue, you can also just enter the desired strings and place an or operator and pass right through nearly all the challenges.

For example,

desired: ie, gah
exclude: e,ah,uai

You can just enter "ie|gah".

from regex.

phikal avatar phikal commented on May 30, 2024

@Zamubafoo That was discussed in #4, and the idea was that there should always be a way out when you can't solve a puzzle, leading to the conclusion to set the max chars to be at least as long to let that happeen. Of course solving it it very simple, but until now you wouldn't be able to progress further into the game when you used that strategy all the time, because you wouldn't be getting any points.

What could be possible, if this is concidered a good strategy, but not obvious, would be to warn they player about it when tried to too often, or of course limit it totally.

As soon as REDB launches this will be a totally different problem anyway.

from regex.

Zamubafoo avatar Zamubafoo commented on May 30, 2024

Oh, I didn't see that it was already brought up.

In my opinion, I think intuitively a pass button in the menu would be more effective than allowing this.

from regex.

phikal avatar phikal commented on May 30, 2024

Funnily enough, there is one. Try long pressing the char-counter. You will move on to the next round, but you will loose a percentage of your points. That should probably be built into some in-game help system, if not mentioned somewhere. But I'm possibly afraid people wouldn't read that.

On 10 February 2016 05:08:32 EET, Zamubafoo [email protected] wrote:

Oh, I didn't see that it was already brought up.

In my opinion, I think intuitively a pass button in the menu would be
more effective than allowing this.


Reply to this email directly or view it on GitHub:
#3 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

from regex.

phikal avatar phikal commented on May 30, 2024

Took me longer than I though, but since #18 is closed, and REDB is running, this issue should be "solved" for now. I also tried and change a few things regarding the random character generator, so I'll see how people respond to that.

As soon as the database has enough tasks (and maybe I get a few new translations I've been asking a few friends for) I will publish v1.3.

from regex.

Hugo-Trentesaux avatar Hugo-Trentesaux commented on May 30, 2024

Because strings are random, it is very easy to write short regexp which describes just a part of the strings :

example

match :

  • akzdjbf
  • fkvdfk
  • jbvj

do not match :

  • gdada
  • fkdl
  • dfdbn

regexp :
^(a|fkv|j).*

algorithm to produce this regexp :

  1. write ^(
  2. write the first letter of the first word
  3. if this letter is not the first letter from "do not match" word write | else write the second letter (and so on)
  4. write ).*when you are finished

The interest of regular expression is to condense the meaning (information) of a string. If there is no meaning (random) there is no interest.

The random game is useless. But an "extract information" game as in this tutorial might be interesting.

from regex.

phikal avatar phikal commented on May 30, 2024

@Hugo-Trentesaux To be fair, ReGeX is more of a proof-of-concept than a challenging puzzle-game. And btw, the regular expression always has to match the whole string, so ^ (and $) aren't necessary.

Sadly I don't quite have the time to really work on ReGeX anymore... but when (if at all) I manage to get around, the random game can be improved by implementing reverse-regular expressions, to make it a bit less "useless" (where, if I want to be fair, wouldn't quite agree, expecially on levels 14+).

And finally: The last time I re-wrote ReGeX, and actually created the infrastructure of a "extraction game". When I get around to it, I will take a look at the tutoral you linked, to see what would make sense to also adopt.

from regex.

KOLANICH avatar KOLANICH commented on May 30, 2024

I wonder if it is possible to create a generator of hard sets of cases with adversarial reinforcement learning.

from regex.

phikal avatar phikal commented on May 30, 2024

While I'm not going to claim that it is impossible, I do belive that something like that would be outside of the scope of a quasi-"hobby project" like this one. If someone were to submit a pull-request adding such a thing, great, but otherwise I wouldn't want to guess that something so sophisticated would be added in the (close) future.

from regex.

wilyarti avatar wilyarti commented on May 30, 2024

I have two ideas:

1.) Create 3x 80 char strings that are mutated slightly. The user has to select the correct one via regex.
2.) Create a blob of text that the user has to extract value(s) from.

The difficulty could be increased by setting time limits or restricting the use of the previously mentioned cheat regex's.

Excellent game by the way. I really enjoyed solving the reg expressions. This is exactly what we need to over come the fear of regex.

from regex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.