August 15, 2018, 09:44:54 PM

Author Topic: ForWord - Code a game competition - May 4th to June 30th  (Read 893 times)

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
ForWord - Code a game competition - May 4th to June 30th
« on: May 12, 2018, 11:22:51 AM »
Puzzle/endless catagory.

You get letters.  You must form words within the time limit. Used letters are replaced by new letters. Letters have point values. Bonus points based on length of word, letter position, and using all letters in a word. Game will be more interesting than my description.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline round157

  • Jr. Member
  • **
  • Posts: 91
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #1 on: May 12, 2018, 01:18:08 PM »
Puzzle/endless catagory.

You get letters.  You must form words within the time limit. Used letters are replaced by new letters. Letters have point values. Bonus points based on length of word, letter position, and using all letters in a word. Game will be more interesting than my description.


Hi, this gameplay sounds quite entertaining. Will you show us some screenshots soon? What language is used to write this game? Thanks.

Good luck to you.

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #2 on: May 16, 2018, 11:59:38 AM »
Discovered some interesting stuff while creating this game.  Downloaded the Enable word list form http://www.puzzlers.org/dokuwiki/doku.php?id=solving%3awordlists%3aabout%3astart#scrabble_tm_dictionaries.
Then I stripped all the words less than three letters and more than seven.  Then I created a frequency list and used that to determine the point value for each letter based on how often it appeared in the list.  The below is sorted, least frequent first.  Was surprised to discover that the letter j appeared less often than the letter x or z.
Code: [Select]
q:0.0017658473685380626:10
j:0.0032268002274004884:10
x:0.0035920384421160951:10
z:0.0048052645118670662:10
v:0.0095343053963152236:9
w:0.013056472179963984:9
k:0.015702067248295291:8
f:0.015959321990834108:8
y:0.020434284117219235:8
b:0.023549924887967148:8
h:0.024956886010741180:8
m:0.029028498108701246:7
g:0.029679574926237760:7
p:0.030273484023210093:7
c:0.034500719360483767:7
u:0.037997478268326224:6
d:0.042278705341688289:6
n:0.054833371974477789:5
t:0.054855603865808303:5
l:0.055081098763589242:4
o:0.060658127503072763:4
i:0.070230544713097448:3
r:0.071358019202002146:3
a:0.082105550668068336:2
s:0.093094456954294413:1
e:0.11744155394568431:1

So I thought I'd try it on the original Enable file.  J beat even Q for least frequent letter!
Code: [Select]
j:0.0015898990156251989:10
q:0.0016140945152622664:10
x:0.0029352961401810842:10
z:0.0047435913762145501:10
w:0.0074426630330968963:9
k:0.0084767022807442031:9
v:0.0097819858137965284:9
f:0.012311052249544742:9
y:0.016323684847249990:8
b:0.018360563882486278:8
h:0.023235957059355380:8
g:0.027012365173761890:7
m:0.028353941956269817:7
p:0.029379067072471888:7
u:0.032663287786366471:7
d:0.033832949176716288:7
c:0.040864288715983035:6
l:0.053119946005832391:5
o:0.065923822379563721:3
t:0.066834973958001712:3
n:0.068461166223082501:3
r:0.070716441478727063:3
a:0.075671425114928623:2
i:0.090073477912055722:1
s:0.095160900072586499:1
e:0.11511645676009526:1
So I tried it on the Webster New International Dictionary word list. http://www.puzzlers.org/dokuwiki/doku.php?id=solving%3awordlists%3aabout%3astart#ni2--webster_s_new_international_dictionary_second_edition.  J is still at the top of the list.
Code: [Select]
j:0.0011949968149878279:10
q:0.0016394171180824746:10
x:0.0030678468195442584:10
z:0.0036850972405090454:10
w:0.0060625214073668724:9
k:0.0069684205706446473:9
v:0.0088753876893780410:9
f:0.010612218146623685:9
b:0.017507466485546689:8
g:0.020657912634150961:8
y:0.023068556096391621:8
h:0.028312266763511389:7
d:0.030126309637052262:7
m:0.030831995209238915:7
p:0.034041697398255806:7
u:0.039057811001063467:6
c:0.045275655059814936:5
l:0.057976648630983459:4
s:0.061483977750254645:4
t:0.067808213336110590:3
n:0.070762037168800251:3
r:0.071758167120888158:3
o:0.076212695067967129:2
a:0.088170743586992575:1
i:0.089840237634678424:1
e:0.10500170361116186:1

Thought this was very interesting. :)

@round157:  I am planning on using AGK2 to program the game as I believe this would make a great game for mobile platform and I have found AGK2 to be the easiest for creating multi-platform games.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Rooster

  • Sr. Member
  • ****
  • Posts: 355
  • I don't know what this does...
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #3 on: May 16, 2018, 08:59:37 PM »
Wow, that's interesting. :o

Offline round157

  • Jr. Member
  • **
  • Posts: 91
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #4 on: May 17, 2018, 01:48:32 AM »
So according to the Webster New International Dictionary word list, the top 5 are e, i, a, o, r?

Four of them are vowels!

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #5 on: May 20, 2018, 09:35:55 PM »
Currently working on the interface.  The image is what I have so far.  I am aiming this game for mobile as I think it will work best for that, which is why I have the resolution like I do.

------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline round157

  • Jr. Member
  • **
  • Posts: 91
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #6 on: May 20, 2018, 09:50:16 PM »
Hi, I like the interface of this game.

This user interface is tidy and not too complicated.

Offline Xerra

  • Full Member
  • ***
  • Posts: 167
  • We all float down here, Billy. You'll float too !!
    • Retro Evolved
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #7 on: May 20, 2018, 10:58:42 PM »
Are you planning to put this game just on mobile or have a desktop build as well? Just thinking for when it's judging time and some people might not be able to try it?

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #8 on: May 21, 2018, 12:01:45 AM »
There will be a windows version. Rules of the contest require it :)
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1034
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #9 on: May 21, 2018, 09:23:27 AM »
There will be a windows version. Rules of the contest require it :)
Windows version or an online version as minimum :)

Word games are what I play for 10 minute quick blasts so I'm quite curious to see how this turns out. Don't forget to add the words SyntaxBomb and Qube in :P
Until the next time...

Offline Derron

  • Hero Member
  • *****
  • Posts: 1166
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #10 on: May 21, 2018, 11:33:11 AM »
Hope you add enough polishing-time then. Such "simple to play, hard to master"-games really benefit from polishing. Do not make it look like Minesweeper in Windows 9x.

- if you have time, add "swirling/curling" letters (so they are not 100% visible all the time)
- add some particles when scoring/removing letters
- add 3rd dimension so you can properly have a "qube"-board (joke)
- if you like, make it cute (for children to play) - add some eyes to the letters (overlay, so easy to animate)
- ...
such games have huge potential as they are perfect "time killers" - but as there are plenty of them, you need to think of a special "twist" to make it an interesting play, and you need to invest (time) in visuals to make it look nice.


bye
Ron

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #11 on: May 21, 2018, 01:41:33 PM »
Definitely will be adding a lot of polish over its development. Don't know how much I'll get done by the deadline.  I will be adding more elements to the main interface, such as score, bonus points, menu, etc..  right now,I have finished with keyboard input and checking for valid words.  Now I need to create touch input for mobile and replace used letters with new ones.

Once I get the main part of the game working, then I'll add the polish.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 288
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #12 on: May 24, 2018, 01:56:39 PM »
Hit a bit of a snag, came up with a solution. 

The game was coming along great on my PC, but when I tried it on my android, a part of it was too slow.  The part giving me problems was a function that would replace the used letters with new ones.  I didn't want to just pick letters at random as I wanted to make sure that the letters will be able to make at least 1 new word.  So I created a list with 7 letter words.  The function would check each word in the list and see if it contained all unused letters.  If it did, it was added to a new list, then one of the words on the new list would be chosen randomly.

My PC is fast enough for this method.  It would only take 2-3 seconds to choose a new word, which I could hide easily enough with a short animation before the next set of letters show up.  On my Android, the delay could be 6-7 seconds, which lasts well beyond the animation (I don't want the animation too long as that would just be too annoying).  This leaves a very noticeable pause in the game.

After reading about inverted index https://en.wikipedia.org/wiki/Inverted_index, I thought of a new strategy for determining new letters. I would create a second database containing 26 entries, one for each letter.  Each entry would consist of a list.  The list will contain the index of all words that contain that letter, and the number of times the letter appears in the word.  Now to check the remaining letters against this database and copy the indices that appear in all sets.  For example, if I want to find all the 7 letter words that contain "bstt", first I make a set containing all the entries from the b set.  Then I check this set against the s set, removing any entries not found.  Then I check this one against the t set, if the entry is not found, or the number is less that 2, then it is removed from the set.  The resulting set is all entries containing at least 1 b, 1 s, and 2 ts.

Now I just need to figure out exactly how I am going to implement this idea.  Hopefully it will prove to be fast enough as I won't need to check every word, I can better optimize the searches, and I no longer need to use Mid() to check letters individually as I only need to check against indices.

Here is the game so far on my PC before adding the new optimizations.  I will be adding more features as well.  For example, there will be a time limit forcing you to find words quickly.  Bonuses will appear randomly giving letters extra points, multiply word values, and increase time limits.  The game will progressively get more difficult as you score higher,  requiring you to find longer words and giving you less time.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Offline Derron

  • Hero Member
  • *****
  • Posts: 1166
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #13 on: May 24, 2018, 04:46:21 PM »

video not playable.


@ Mid()
You know you can access a string's letters in BlitzMax using "mystring[index]" ? It returns the numeric keycode for the letter (so the equivalent of Asc("h") - or the opposite of Chr(13) which is "enter").

That way you could do your lookups pretty easy.


There is another speedup thing: caching.
on each letter you add, you store what you have "for now" so you do not need to lookup these things each time. Adding a letter can reuse the cache, removing a letter invalidates the cache.
Same can be said for the lookup: if you know that the "up to now used letters" are not forming a word beginning with one of these letters, you might not have to lookup these ones again. This step is a bit more advanced and should really only be taken if the simple cache + lookup-speedup do not improve your "word lookup"-times.



bye
Ron

Offline Matty

  • Sr. Member
  • ****
  • Posts: 416
    • MattiesGames
Re: ForWord - Code a game competition - May 4th to June 30th
« Reply #14 on: May 24, 2018, 08:02:25 PM »
There is an alternative method that is not perfect but should work well enough:

You have 7 letters.  'N' remain.  'M' need to be replaced. M = 7 - N.

Each letter of the alphabet has a score indicating 'frequency of occurring in a 7 letter word' (precalculated).
Excluding the N letters that already exist in the puzzle add letters 1 at a time with no repeats using the highest frequency letters.

Then you only need to check 26 'scores' M times.

It won't be perfect but it will most of the time give you letters to create a seven letter word.

You can also put a second score in of most often used letters to reolace that is generated at runtime to prevent the same words coming up over and over.