View Single Post
Old 03-13-2018, 10:46 AM
Spike1007 Spike1007 is offline
Senior Member
Join Date: Aug 2017
Posts: 375
Spike1007 has received several accolades

It's getting later (for me, for thinking) but I think I understand what you're saying. In spite of the way I described things, I also used row/column addressing. I dimensioned the board marker as mark(0:6,0:6) and set all "out-of-bounds" points as "used" (and hopefully never changed). For every letter position, I'd sweep over all 8 neighbors (including those "outside" the grid, but they'd be marked as used and therefore ignored. (I think that the way I described it, it would be more efficient, since there never any of these "out-of-bounds" things. They were just addressed once and for all in some a global neighborhood vector, which kind of forgot to address specifically.)

I'll have to read what you said more carefully, but I think we're just doing the same thing in different ways. (By the way, I'm using integers for my "mark" array, but yes, tests would probably be faster using shorter integers or just logical values.)

I've also thought about using integer values for 3-letter strings (aaa = 1, aab = 2, and so on) and just keeping a vector for what's available on the board (after a first pass examination, which is fast) with just TRUE/FALSE stored. Keep a vector based on these numerical values, based on whether the string appears or not. That would allow for checking a 3-letter match based on a simple arithmetic operation & a test, rather than a search. (For the hell of it, we could store the possible locations of the three-letter strings that do appear, cutting down search times if there's a match.)

Like I said, the dinosaur Fortran I use doesn't use recursion. However, I assume that it's fast in character comparisons, although I've never tested that. It could be compiler-dependent though.

Last edited by Spike1007 : 03-13-2018 at 11:16 AM.
Reply With Quote