This is a Python solver for the game Wordle, which recently received its PT-BR version

Overview

PT_BR_Wordle_Solver

Este é um solver feito em Python do jogo Wordle, que recebeu sua versão PT-BR recentemente.

Onde jogar

Os sites para se jogar mais famosos até agora são:

Arquivos

  • Um arquivo .csv, que contém uma lista de aproximadamente 6 mil palavras da lingua portuguesa que contém cinco letras. As palavras não contém acento, nem letras maiúsculas, e apenas 5 caracteres por célula.
  • Um arqivo .py, que é o próprio solver.

Funcionamento

Parte 1:

A partir da primeira tentativa do usuário, teremos no resultado o que chamei de "acertos": acerto verdes, amarelos e vermelhos. De início, o usuário terá que indicar o número de cada acerto. Veja que a somatória do número de acertos é sempre 5. Em seguida, será requisitado quais letras correspondem a cada acerto, e as posições dos acertos verdes e amarelos, variando de 0 à 4. Isto é, a primeira posição equivale a 0, a segunda a 1, e assim por diante.

Com essas informações em mãos, já é possível filtrar a base de dados, a partir dos seguintes filtros encadeados

  • Filtro verde:

    • Procura todas as palavras na base de dados que tem a letra informada no local informado
  • Filtro amarelo:

    • Do conjunto de palavras resultante do filtro verde, procura todas as palavras que contém a letra informada, e que não estão no local informado.
  • Filtro vermelho:

    • Do conjunto de palavras resultante do filtro amarelo, procura todas as palavras que não contém a letra informdada.

Finalmente, obtendo uma lista de todas as palavras da base de dados que atendem às restrições anteriores.

Parte 2:

Como o objetivo do jogo é acertar todas as letras da palavra, e não necessariamente acertar a palavra toda diretamente, podemos usar a frequência das letras nas palavras da lingua portuguesa a nosso favor.

Veja que podemos atribuir à cada letra uma "frequência", explicitada no site https://pt.wikipedia.org/wiki/Frequ%C3%AAncia_de_letras.

Como pode ser visto, a letra "a" tem a maior frequência de aparição na língua portuguesa, por volta de 14%. Isto nos dis que, ao pegar uma palavra aleatória da língua portuguesa, há aproximadamente 14% de chance de ser uma palavra com a letra "a".

Assim, naturalmente, palavras que contém letras que são mais frequentes na língua portuguesa tem mais chances de acertar alguma letra da palavra secreta do jogo.

Finalmente, é atribuído para cada letra do alfabeto um escalar correspondente a sua frequência, e para cada palavra no conjunto resultante dos filtros, soma-se esses valores de cada letra de uma palavra, e atribúi-se o valor da soma à palavra.

Desta forma, palaras com um valor maior tem mais chance de conter alguma letra que está na palavra secreta do jogo.

Por fim, todas as palavras do conjunto são mostradas, assim como o valor da soma associada, e começa-se a próxima iteração.

Observações:

  • Coloque o arquivo .csv e o Script na mesma pasta em seu computador para que o solver funcione.
  • A base de dados ainda é pequena. Não funciona em 100% dos casos, mas é bem satisfatória.
  • A rotina está bem infantil. Utilizei a oportunidade para REVISAR Python, então há muito espaço para aprimoramento, mesmo com poucas linhas de código.
Owner
Vinicius Jameli
I'm a 21 years old researcher, finishing my major in applied mathematics at IMECC.
Vinicius Jameli
A short non 100% Accurate Solar System in pygame

solar-system-pygame Controls UP/DOWN for Emulation Speed Control ESC for Pause/Unpause q to Quit c or ESC again to Continue LEFT CLICK to Add an orbit

LightCrimson 2 May 28, 2022
Guess number game with PyQt5

Guess-Number-Project Guess number game with PyQt5 you can choose a number in your mind and then computer will guess a nummber and you guide the comput

MohammadAli.HBA 1 Nov 11, 2021
Chess GUI

Lucas Chess Lucas Chess is a GUI of chess: To learn to play chess. To play chess against engines. Dependencies Python 2.7 PyQt4 PyAudio psutil Python

Lucas 322 Dec 20, 2022
user friendly python script who is able to catch fish in the game New World

new-world-fishing-bot release 1.1.1 click img for demonstration Download guide Click at latest release: Download and extract bot.zip: When you run fil

297 Jan 08, 2023
This is Minesweeper coded in Python. It has almost all features from the main game

Minesweeper This is Minesweeper coded in Python. It has almost all features from the main game Use right click to open tile, right click on an open ti

3 Jul 12, 2022
Solution for automation games play-to-earn

Pillow automation used processing images

Luis Eduardo Camilo 1 Jan 19, 2022
Console 2D GameEngine {C2DGE} [0.1.0]

Console 2D GameEngine {C2DGE} [0.1.0] By Grosse pastèque#6705 The Project's Goal : This projects was just a challenge so if you have bad reviews, it's

Big watermelon 1 Nov 06, 2021
Unknown Horizons official code repository

Unknown-Horizons based on Fifengine is no longer in development. We are porting it to Godot Engine. Please dont report any new bugs. Only bugfixes wil

Unknown Horizons 1.3k Dec 30, 2022
CTF (Capture The Flag) started from DEFCON CTF, a competitive game among computer security enthusiasts

CTF Wiki 中文 English Welcome to CTF Wiki! CTF (Capture The Flag) started from DEFCON CTF, a competitive game among computer security enthusiasts, origi

CTF Wiki 6.4k Jan 03, 2023
Creates a landscape with more accurate river generation in Minecraft version 1.12 using python.

MinecraftLandRiverGen View the following youtube video to set up a world that can interact with the python programs

23 Dec 25, 2022
A solution program of 24. game.

A solution program of 24. game.

1 Dec 12, 2022
A small fun project to simulate Conway's Game of Life, created in Python.

A small fun project to simulate Conway's Game of Life, created in Python. Conway's Game of Life simulates a grid of cells, where the state of each cell consists of whether the cell is alive or dead.

Harrison Verrios 1 Jun 19, 2022
Play a game of Phazed with a bot or with other players or watch bots play with each other

Phazed Game and Player play a game of Phazed with a bot or with other players or watch bots play with each other Live Demo hosted on repl.it (makes su

Xin Yu 0 Aug 28, 2021
PyCraft - A Minecraft launcher made in python

A Minecraft launcher made in python. The main objective of this launcher is to enable players to enjoy minecraft (especially those without a mojang/microsoft account). This launcher is not illegal as

38 Dec 12, 2022
An old time game Tic-Tac-toe

A Tic Tac Toe Bot This is the code repository for my article on Medium - Playing Games with Python - Tic Tac Toe, where I have tried to take the famou

Jigyanshu 0 Feb 25, 2022
A car learns to drive in a small 2D environment using the NEAT-Algorithm with Pygame

Self-driving-car-with-Pygame A car learns to drive in a small 2D environment using the NEAT-Algorithm with Pygame Description A car has 5 sensors ("ey

Henri 3 Feb 01, 2022
🎅 Celebrating 2021 Christmas with the development of this game

ChristmasGame (DEVELOPING) 🎅 Celebrating Christmas with the development of this game You can also use this engine to create your game too, just empty

Érik Freitas 5 Jan 10, 2022
A Pygame game made in 48 hours

Flappuccino Flappuccino is a game created in 48 hours for the PyGame Community New Years Jam using Python with Pygame. Screenshots Background Informat

PolyMars 242 Jan 02, 2023
A use of the python MCPI to enhance the multiplayer and singleplayer gameplay.

Morpheus 2.0 A use of the python MCPI to enhance the multiplayer and singleplayer gameplay. To Use: You will need to install the keyboard, pysimplegui

11 Oct 11, 2022
Pratice Project - Tic tac toe game

Hello! This tic-tac-toe game project and its notes are result from a course pratice milestone. The project itself is written in Python using the Jupyt

Rafael Nascimento 1 Jan 07, 2022