Word game

@Bri_G You can’t use the alpha as the fourth variable, it has to be 255. See this link where I ran into the problem back in Sept 2012.

https://codea.io/talk/discussion/1709/saveimage-readimage#latest

@dave1707 - Oooh, missed that. Thanks for the link.

Fascinating, Dave, thanks!

I wrote this article because I found Dave’s packing to be an interesting trick and totally have similar things in my history, but in my casual flying through, I just didn’t get how it was even possible. Very strange how this slipped through the net of my mind.

Thanks!

Odd Thing

@RonJeffries Read your latest article, but then I usually read them all or at least scan thru them. Just a note, my first dictionary image of words was 1025x1025 and contained 300,249 words. I used that to extract the 5 letter words.

@RonJeffries - coming from a background of personal computing in the UK I quickly picked up on carefull use of small levels of memory. The Spectrum and similar computers had very little memory to play with and my 32k BBC had tons (for then). In the States the drive seemed to be throw more memory in, in the UK it tended to be get cleverer with it. Hence the rise of compression systems for graphics.

I started a thread about a computer game which, at the time, was awe inspiring - Elite. With 32K the authors were able to generate 3D wireframe graphics of spaceships, planets and space stations with descriptions of the populace, planet types, and produce. It incorporated commerce trading, battles, policing and missions.

A universe of 8 galaxies, each with 256 planets was provided all derived by clever manipulation of bits and bytes. It was, and still remains , a masterpiece

Today, of course, you can play Elite Dangerous (from one of the original authors) on your PC with textured 3D graphics - having thrown tons of memory and decades of microcomputer development at it. But, clever things we’re done years ago with very little kit at hand, something we tend to forget

Where did you get the original list? One of these days I need to figure out file io in Lua …

@RonJeffries I just did a search for downloadable dictionaries. I found one I liked with a large amount of words to use. Don’t remember which one it was.

What questions do you have about Codea file io. I played around with it quite a bit when it first came out. I should still have several examples that I think might work. I stopped using it when readText was added.

@RonJeffries @dave1707 - a quick search revealed a lot of sources for word lists. Looking up Scrabble dictionaries etc narrows the field. I didn’t find any large collection but many small ones, so I have started compiling them. All of them need filtering to take out inappropriate words, names etc. When I have my list compiled I will post as CSV and as an image.

It could be useful for anyone using Codea for word based games etc.

Hey everyone. Thought I’d share my French version of Wordle here as there might be some interesting code.

The list of words was generated from a French word list I found. I initially created a project to parse the original file and keep only the five letter words (included in the zip).

Things which might be useful:

  • Using io.lines to read the list of words.
  • Share results (e.g. on Twitter) using objc
  • Keyboard handling (only allowing for letters), hit enter to confirm word
  • Word entry validation using objc.cls.UIReferenceLibraryViewController:dictionaryHasDefinitionForTerm_(word). (This is important since the online dictionary I found is quite limited).
  • process_word: code used to color each letter properly when hitting enter. e.g. when a user enters a word with multiple 'E’s and the goal only has one, only the first E should be colored orange if none are in the right position.

@jfperusse I just gave it a try but it looks like I’m missing the asset.documents.five_letters resource. Any chance of bundling one into the project itself?

@jfperusse - couple of problems here, don’t see the word list an a call for Drawbuttons() which doesn’t seem to be present. Is that a dependency?

Strange, I’m pretty sure I added it manually to the zip file, but I’ll add it here instead.

@jfperusse ah my fault. You probably did but I unzipped it in the files app on my phone while walking and it probably landed in a random place on my file system :grimace:

I am also getting the error for DrawButtons():

Main:201: attempt to call a nil value (global ‘DrawButtons’)
stack traceback:
Main:201: in function ‘draw’

Oh! Strange that it didn’t include the dependencies! I’ll have to take a look at it later. Sorry for that, I guess I don’t often export projects

@Bri_G, @Simeon I created a version which includes the dependencies I was using as extra tabs. Hopefully, that should resolve the issues!

@jfperusse Tried your word game. It didn’t show what the word was after all misses. The keyboard also covered up the bottom set of squares.

@dave1707 Haha, I definitely should add that to the game, thanks for the suggestion!

@jfperusse I shrunk the squares so they were all above the keyboard. So far the only thing was the word not showing after all the tries.