Log In  


Cart #wordle-1 | 2024-03-17 | Embed ▽ | License: CC4-BY-NC-SA
6

Wordle for Picotron

This is a basic wordle clone. A green letter is in the correct position, a yellow letter is in the wrong position, and a gray letter is wrong.

This uses an invisible text editor to let you type the letters. Press enter to submit your guess.

If you enter a guess that is less than 5 letters, it will clear your text input. There is also no check to see if your guess is a real word, so you can enter random letters if you want. The word list I used is the official wordle list, which I got from here.

Hope you enjoy it!

Changelog

[2024-03-17]

  • Gray boxes on the line you're typing always display
  • Fixed off by 1 when choosing a random word
6


Great wordle clone - nice one! 😁👍


1

I love this! It turns out I rely a lot on the little keyboard they show with the 'used'/'unused' hints, I kept repeating letters foolishly that I'd already ruled out...

PS: it seems possible to make a web request to the official wordle solutions for the day so it can align with other NYT players ;) Don't run this lua script if you don't want your Wordle spoiled for the input date, which defaults to today's UTC date (which might be tomorrow for your local time!)

wordle.lua:

function get_wordle(for_date)
	for_date = for_date or (split(date()," ")[1])
	local official = fetch("https://www.nyt".."imes.com/svc/wordle/v2/"..for_date..".json")
	local apart = split(official, ":")
	for i=1,#apart do
		if apart[i]:sub(-9) == "solution\"" then
			return apart[i+1]:sub(2,6)
		end
	end
	return false
end

local argv = env().argv
local for_date = nil
if(argv[1]) for_date = argv[1]

local wordle = get_wordle(for_date)
if wordle then
	print("wordle word for "..(for_date and for_date or "today (UTC)")..": "..wordle)
else
	print("wordle word unknown, cannot fetch")
end

It's pretty hacky, but I don't think we can natively parse JSON..


2

Oh, that's neat! Maybe I could add a mode that lets you do the daily puzzle.

I don't think there's a way to parse json natively, but there are lua json libraries. This one seems to work fine. (You do have to make two changes: make the json variable global, and remove the return json line at the end.)

https://gist.github.com/tylerneylon/59f4bcf316be525b30ab



[Please log in to post a comment]