Author Topic: Scramble/Boggle Lua  (Read 22376 times)

0 Members and 1 Guest are viewing this topic.

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Scramble/Boggle Lua
« Reply #15 on: July 24, 2012, 12:56:52 pm »
Notepad++ took more like a whole second to paste everything (over 1,000,000 characters after all).  :P

Notepad++ is kind of the exception. It's a very lightweight program  :D. Bulky IDEs like the script editor in the student software tend to crash (or come very close) when I paste in the code, though. I don't even think the syntax highlighting can be turned off in the student software to avoid this issue.  :(
That's why I had to use the old scripting tools and Notepad++.

I clarified this in my previous post.
« Last Edit: July 24, 2012, 12:58:31 pm by 3rik »
Userbars

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Scramble/Boggle Lua
« Reply #16 on: July 24, 2012, 01:45:23 pm »
Notepad++ took more like a whole second to paste everything (over 1,000,000 characters after all).  :P

Notepad++ is kind of the exception. It's a very lightweight program  :D. Bulky IDEs like the script editor in the student software tend to crash (or come very close) when I paste in the code, though. I don't even think the syntax highlighting can be turned off in the student software to avoid this issue.  :(
That's why I had to use the old scripting tools and Notepad++.

I clarified this in my previous post.

oh well, never mind then, my pc is probably faster than yours  >:D
« Last Edit: July 24, 2012, 01:45:32 pm by Nick »

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Scramble/Boggle Lua
« Reply #17 on: July 24, 2012, 01:51:49 pm »
Wouldn't be surprised. Mine is actually just a laptop hooked up to a monitor. I think I was also running a bunch of other things when I first tried pasting into the student software.
Userbars

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Scramble/Boggle Lua
« Reply #18 on: July 24, 2012, 07:15:26 pm »
Once again, another great Nspire project!  Good work! :D


Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Scramble/Boggle Lua
« Reply #19 on: July 24, 2012, 08:39:11 pm »
I use Notepad++ and nspire_emu!  :D I write my own C++ program to format the file.

3rik, I'll give your method a try. As long as you didn't get a memory error, that method will work.

I still wish that loadstring thing worked though, it would've been nice.  :(

EDIT: I get a memory error in nspire_emu :(, even using 3rik's shrunken dictionary. Oh, and 3rik's program also causes a memory error in nspire_emu D:
« Last Edit: July 24, 2012, 09:43:10 pm by cyanophycean314 »

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Scramble/Boggle Lua
« Reply #20 on: July 24, 2012, 10:35:36 pm »
Figures. The student software must allow for more memory to be used. One thing that could be done is generate the table before hand. It would be faster and there wouldn't be two lists of words. 100,000 words is a bit excessive, so a dictionary with less words would also work. I tried actually sending this to my nspire cx, so as long as the rest of the program isn't massive, this should work. There are 81536 words. I'll attach the file of the pre-generated table.

Edits:

It takes a little more than 20 seconds for my calculator to open the document with the script. Indexing the table, however, takes less than a millisecond.

Also, don't forget to assign this table to a variable.

I wouldn't say "shrunken." This dictionary is probably larger than an array with the words. It just indexes a lot faster than an array since most of the guess and check is avoided.
« Last Edit: July 24, 2012, 11:15:37 pm by 3rik »
Userbars

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Scramble/Boggle Lua
« Reply #21 on: July 25, 2012, 09:31:01 am »
Figures. The student software must allow for more memory to be used. One thing that could be done is generate the table before hand. It would be faster and there wouldn't be two lists of words. 100,000 words is a bit excessive, so a dictionary with less words would also work. I tried actually sending this to my nspire cx, so as long as the rest of the program isn't massive, this should work. There are 81536 words. I'll attach the file of the pre-generated table.
Yeah. Having a pregenerated table is nice. Probably saves memory too. 80,000 words is around half my library of 170,000+ words. I'll test some stuff, and maybe 80,000 will be good enough.

I wouldn't say "shrunken." This dictionary is probably larger than an array with the words. It just indexes a lot faster than an array since most of the guess and check is avoided.

The dictionary you used is actually a lot shorter than mine. The filesize was noticeably smaller (by maybe 100+ kilos).

Edit: The pregenerated table still generated a memory error D: Why will this program not cooperate?
« Last Edit: July 25, 2012, 10:12:22 pm by cyanophycean314 »

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Scramble/Boggle Lua
« Reply #22 on: July 27, 2012, 11:22:28 pm »
When I load the script with the pre-generated table, Lua is using ~20 MB of the 64 MB of operating memory. TI probably set the max level lower than full capacity. So, maybe the table by itself is just small enough to fit in under their max but when the rest of the program is running, Lua uses even more memory and that signals to Lua to throw an error.

I can attach the program I used to generate the table and you can experiment with shorter tables.

I was looking at the 12dicts wordlists. Here's a download link: http://downloads.sourceforge.net/wordlist/alt12dicts-4.zip.
They come with some symbols to catagorize some of them, but I just deleted them all. I just used the replace feature in Notepad++ and turned on regular expressions. I had it find
Quote
[^a-z]
and replace it with nothing.

I also had it replace
Quote
\r\n
with
Quote
","
and added the brackets to make it a table.

Then, I assigned the result to the variable "list" in the attached program and ran it using Lua (on the computer). It will write to (or overwrite) a file called pregendict.txt (in the current directory) with the code for the pre-generated table.
Userbars

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Scramble/Boggle Lua
« Reply #23 on: July 29, 2012, 11:33:49 am »
IT'S BEEN DONE!  ;D

Well, the solution to the problem was really underwhelming. I simply used a bunch of strings to store all of the words, separated by semicolons. And then, I put them into an array.  <_< I didn't test this earlier because I was sure I would have had a memory error. Whatever the case may be with this memory stuff, I now have the Scramble program working with a dictionary of 170,000+ words!

Thank you all for your help and support and ideas!

Right now, the random board generation ain't working too well.  :P

Offline cyanophycean314

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 363
  • Rating: +43/-1
  • It's You!
    • View Profile
Re: Scramble/Boggle Lua
« Reply #24 on: August 02, 2012, 04:36:38 pm »
Progress Report!  :D

(somewhat effective) Random Board Generation, Large 170,000+ words dictionary, A scrolling results page have all been added. Idk why I capitalized those random letters.

Screenshot included.

Edit: Anybody want a release yet?

Edit2: If anybody's wondering why that game ended at 1:30, I just changed the timer value so it wouldn't take as long to get to the results page.

Edit3: I got this little flashing icon  in the top right corner. It's the low memory icon! The same one from that one screenshot from OS 3.2 demonstrating the physics engine! :D
« Last Edit: August 02, 2012, 04:47:39 pm by cyanophycean314 »

Offline nyanfly

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 15
  • Rating: +4/-0
    • View Profile
Re: Scramble/Boggle Lua
« Reply #25 on: August 02, 2012, 11:32:58 pm »
This is based off of Scramble with Friends, right? So you should find a way to add internet connectivity. Maybe even 3G :P.
This is a signature. You are reading it. You will finish this sentence. You will reach the end of this line. There are 227 characters in this signature. There are 42 words. You will now go back and examine this signature again.

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: Scramble/Boggle Lua
« Reply #26 on: August 02, 2012, 11:57:47 pm »
Currently, the Nspire seires doesn't support any kind of wireless or internet connectivity, not even with Ndless. :P

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline ruler501

  • Meep
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2475
  • Rating: +66/-9
  • Crazy Programmer
    • View Profile
Re: Scramble/Boggle Lua
« Reply #27 on: August 03, 2012, 12:22:51 am »
Maybe we could fix that though...

We can write usb drivers so maybe it would be possible to hook it up to the internet one day
I currently don't do much, but I am a developer for a game you should totally try out called AssaultCube Reloaded download here https://assaultcuber.codeplex.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y

Offline 3rik

  • LV3 Member (Next: 100)
  • ***
  • Posts: 92
  • Rating: +8/-0
  • My TI-84+ SE
    • View Profile
Re: Scramble/Boggle Lua
« Reply #28 on: August 04, 2012, 10:04:03 pm »
I'm glad you found a solution. It looks like there's less lag than I expected. A table probably takes up more memory than a string.
Userbars

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: Scramble/Boggle Lua
« Reply #29 on: August 05, 2012, 08:48:45 am »
isn't there a download already? or am i just looking ove rit? because i want to test it, and see how fun it is :)