Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't know if you need "information theory" to do something that can be solved with grep.


Sorry, could you elaborate more about using grep to solve this? I can't imagine how


    $ printf '%s\n' {a..f}{a..f}{a..f}{a..f}|head 
    aaaa
    aaab
    aaac
    aaad
    aaae
    aaaf
    aaba
    aabb
    aabc
    aabd

    $ printf '%s\n' {a..f}{a..f}{a..f}{a..f}|wc -l 
    1296
So say you've guessed acab and gotten two black pins, then you know nothing is in the right position, so you can `grep -v acab` but also that two of your pins should be used somewhere `grep -E 'a.*[cab]|c.*[ab]|b.*[ca]'` (hope I got that right?)

    $ printf '%s\n' {a..f}{a..f}{a..f}{a..f}|grep -v acab | grep -E 'a.*[cab]|c.*[ab]|b.*[ca]'|wc -l
    756
That filters your options down.

However, I don't understand how/whether grepping can give you the optimal next guesses – some of these will give you less information than others. (Of course, you could run some simulations with grep, argmaxing over all the possible responses like the article says, but then you're not just doing simple grepping.)


Each constraint given to you by the game can be done in grep and used to filter a master list of all the answers by piping the filtered list through each constraint.

https://github.com/codebox/wordle.sh




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: