Sharp as a Marble
HomeAboutContactSyndicationLogin
 

Gah. My code I was working on last night hit recursiveville, a place I try not to go unless the fate of the entire universe depends on it.

It's hard enough writing a recursive function that returns everything below it and everything below what's below, but trying to get a 'path' that only returns actual matches gets sticky.

I could brute force it, returning all paths, then simply matching any of the result sets, but that just feel hokey to me, and this is an exercise in stretching my brain to keep it in shape, not just get something done.

Here's what I'm doing. The Mrs. and I love to play both Scrabble and Boggle. Finding words in jumbles of letters is a simple yet satisfying game. I'm trying to write a Boggle like application that will allow us to run the game on separate computers (learning the communications channels between the apps is my main goal).

I've built the grid of letters, but now I need to be able to search through each letter, the letters that surround it for the next letter in line until the end of the attempted word is reached or no path is found. To make it a bit harder, you can't reuse letters that are already in your path and at any point there are up to 8 'paths' that may or may not work for you.

So, I want to be able to pass in an array of characters, find all the paths that match the first character and have an open path afterwards for the next, then loop back into that function, stripping off the first character and then seeing where the next paths are available. Remembering where I've been the whole time.

Oh. Then the $#^*& Qu problem rears its ugly head. Granted there are a few non-u following q words like qanun, qat, qabab, and qepig (An Azerbaijani unit of currency), but in Boggle the tile is always Qu. So, I have to display "Queen" but actually search for "Qeen". And if you type Q without a U I have to put one in there for you. Sounds easy until you realize the computer is pretty dumb and doesn't think about these kinds of things for you, you have to tell it every last thing.

It's good brain exercise. Yes, I know there are already games out there I could download or buy, but that's like saying there's already someone else at the gym so there's no need for me to work out.

rolled out on Wednesday, July 16, 2008 12:45 PM
Comments have been closed on this topic.
 
TipJar
2A Blogger Bash
Other bloggers with guns.

News

Recently upgraded to Subtext 2.0.

Article Categories


General

Archives


October, 2008 (17)
September, 2008 (114)
August, 2008 (93)
July, 2008 (93)
June, 2008 (77)
May, 2008 (79)
April, 2008 (53)
March, 2008 (46)
February, 2008 (46)
January, 2008 (63)
December, 2007 (69)
November, 2007 (63)
October, 2007 (83)
September, 2007 (73)
August, 2007 (84)
July, 2007 (59)
June, 2007 (63)
May, 2007 (35)
April, 2007 (30)
March, 2007 (37)
February, 2007 (32)
January, 2007 (38)
December, 2006 (14)
November, 2006 (28)
October, 2006 (25)
September, 2006 (24)
August, 2006 (28)
July, 2006 (27)
June, 2006 (28)
May, 2006 (14)
April, 2006 (17)
March, 2006 (35)
February, 2006 (33)
January, 2006 (26)
December, 2005 (15)
November, 2005 (22)
October, 2005 (35)
September, 2005 (37)
August, 2005 (50)
July, 2005 (34)
June, 2005 (55)
May, 2005 (53)
April, 2005 (56)
March, 2005 (57)
February, 2005 (77)
January, 2005 (72)
December, 2004 (79)
November, 2004 (76)
October, 2004 (59)
September, 2004 (74)
August, 2004 (69)
July, 2004 (75)
June, 2004 (56)
May, 2004 (28)

Post Categories


Humor (rss)
Views (rss)
Catblogging (rss)
News (rss)
Politics (rss)
Geekdom (rss)
Recipes (rss)
Blogging (rss)
Wingnuts and Moonbats (rss)
War on Terror (rss)
Photography (rss)
Brewsky (rss)
Guns. Lots of Guns. (rss)
Daughter Blogging (rss)
TMI (rss)
Anxiety & Panic Attacks (rss)
Gun Myths (rss)
Reloading (rss)
Range Time (rss)
Anti-Rights Idiocy (rss)
Firearm Safety (rss)
A Cancer Story (rss)
Second Amendment Blog Bash (rss)
Gun Rights (rss)
Gun-Free Zones (rss)
Self Defense (rss)
The Line Is Here (rss)
Getting old sucks (rss)
NRA (rss)
2A Blog Bash (rss)
Out of sight, out of mind (rss)
Video Podcasts (rss)
Para Blackwater Training (rss)
GTI (rss)
You need this (rss)
Competitive shooting (rss)

Image Galleries


Beyond the Pale brewing session

::Other Digs


The Line Is Here

::Sharpest Marbles


Eject! Eject! Eject!
Instapundit
Iraq the Model
Protein Wisdom
QandO
Sharp as a Marble
Vodka Pundit
WILLisms
Witting Shire
Wizbang

:Second Amendment


A Keyboard and a .45
Alphecca
Another gun blog
Anthroblogogy
Armed and Safe
Call Me Ahab
Carnaby Fudge
Days of our Trailers
Double Tapper
Dustin's Gun Blog
Fighting for Liberty
Great Blue Whale
Gun Owners Against Violence
Gun Pundit
Guntards
Justin Buist
Live from the (upper) Texas Gulf Coast
MArooned
Mausers and Muffins
Mike-istan
Musings of the Geek with a 45
Notes from the American Outback
Oleg Volk
Papa Delta Bravo
Pro-Gun Progressive
Random Nuclear Strikes
Ride Fast and Shoot Straight
Roberta X
Say Uncle
Sear and Hammer
Snowflakes in Hell
The Anarchangel
The Armed Schoolteacher
The Bitch Girls
The Breda Fallacy
The Countertop Chronicles
The Law Dog Files
The Liberty Sphere
The Mad Rocket Scientist
The Madman Raves
The Other Side of Kim
The Real Gun Guys
The Sentinel
The Smallest Minority
The View From North Central Idaho
The War on Guns
View from the porch
Walls of the City
West, By God
Xavier thoughts

Blogroll


Guide to Midwestern Culture
Basil's Blog
Captain's Quarters
Coalition of the Swilling
Cold Fury
Cranky Neocon
Daily Pundit
dorkafork
File It Under
Florida Cracker
Garfield Ridge
INDC Journal
Is Full Of Crap
Medium at Large
Notes from the trenches
One Ping Only
Sean Gleeson
Sekimori
Sissy Willis
Six Meat Buffet
Speed of thought
Squeaky Wheel Seeks Grease
The Belmont Club
The Munchkin Wrangler
The Spoons Experience
The Unforgiving Minute
Tim Worstall
UNSpace
Vern's Blog

Extended Blogroll


21st Century Paladin
Bill Peschel
Cowboy Blob
Craziness
Flight Pundit
Hubs and Spokes
In the Right
Pajamaverse
PEER Review
TechnoChitlins
The Tygrrrr Express

Funny, as in Ha-ha


Ace of Spades HQ
Cox & Forkum
IMAO
ScrappleFace
The Superficial
Topic Drift
Wuzzadem

Good Reads


Drink This
Evil White Guy
Leaning to the Right
Ramble Strip
Save the Soldiers
SondraK
The Resplendent Mango
Triticale
You Big Mouth You

Tampa Area Blogs


Tampa Film Fan

My Technorati Conversations

Hang in there Mom

Cool Post-it Note Icon