Problem-Solving

I've been spending some time learning and reviewing algorithms recently. For example graph theory (Djikstra's algorithm, Prim's algorithm), Markov chains and Bayesian inference, the Simplex algorithm, and dynamical systems.

This has become surprisingly entertaining for me, primarily because my habitual problem-solving method is not at all similar to how these kinds of problems are solved. It's hard to explain, but it seems like by playing around with all these abstract techniques, it kind of forces me to start thinking of problems more abstractly; in terms of structure, rather than semantics.

For example, suppose I'm trying to write a Minesweeper clone.

My normal problem-solving technique would be to start with the concept of a "cell", which has "neighbors", and a "nearby-bomb-count", etc. This cell concept feels like a concrete, solid thing, almost as if it could inhabit physical space.

In contrast, after reading about lots of algorithms, I want to break the problem down by starting with the concept of a "grid", which is an abstract concept but is represented visually on the screen. The representation of each cell of the grid is some function of multiple state spaces, which are then combined in a Cartesian product. For example, whether the cell is covered or uncovered is one state space, and the grid of bomb locations is another state space. Rather than combining both of those states as member variables in the same "cell" class, I think of them as being represented in completely unrelated data structures. The visual representation of a cell, then, is a function of both data structures.

I'm not sure what exactly is the qualitative difference between these two views, except that the first view seems more intuitive, while the second view seems more decoupled and extensible.

Posted on December 8, 2004 03:46 PM
More programming articles

Comments

the minesweeper example and talk of "grids" as opposed to cells reminds me a lot of some cellular automata work i was doing a while back. to implement a CA in a language like python and have it perform at all well requires this kind of approach. for my stuff, i created "bit planes" as 2-d Numeric arrays and built some infrastructure to allow me to manipulate them. the result is that you can (for the most part) specify CA rules as if they applied to a single "cell" but have them applied to an entire plane at once in a pretty efficient manner. for some example code, see: http://www2.ccnmtl.columbia.edu/cat/index.xml.

Posted by: anders at December 8, 2004 04:26 PM

I think one of the differences is that the first follows directly from an object-oriented mindset, one that most programmers nowadays start out with; whereas the second is perhaps a more functional approach.

I remember going through several similar mini-revelations when I started plodding through SICP a while ago — a project that was sadly soon abandoned.

-K

Posted by: Kaushik at December 8, 2004 06:03 PM

I've decided that the main difference, from my perspective, is that the second approach involves an extra level of indirection. That is:

first approach: data -> screen

second approach: data -> translation -> screen

The second approach feels better because unlike the first approach, there's room for things that aren't immediately visible.

For example, in the first approach I would have ended up storing the location of each bomb as an instance variable on the cell -- because there's no conceptual room for any data that isn't immedatiately visible. In contrast, the second approach would have no problem representing the bombs as a list of coordinates. This might be a much better representation, since you can simply omit cells that don't have a bomb on them -- which reduces the state space, and therefore simplifies the program.

Posted by: Kim at December 12, 2004 06:46 AM

I want to learn about programming language C

Posted by: babuni at April 17, 2008 12:36 AM

Cool post!

Posted by: Online Games at October 25, 2009 04:15 PM

Love this man. Great stuff, great prices, free shipping. Email him if you cant find what you are looking for and he will look for you. Good customer service.louis vuittonSomeone who is knowledgeable in louis vuitton.Another guy from hong Kong (Largest louis vuitton second hand city, I believe) he has great stuff at fair prices but his shipping is insane

Posted by: louis vuitton at October 29, 2009 10:18 AM

Love this man. Great stuff, great prices, free shipping. Email him if you cant find what you are looking for and he will look for you. Good customer service.louis vuittonSomeone who is knowledgeable in louis vuitton.Another guy from hong Kong (Largest louis vuitton second hand city, I believe) he has great stuff at fair prices but his shipping is insane

Posted by: louis vuitton at October 29, 2009 10:18 AM

Love this man. Great stuff, great prices, free shipping. Email him if you cant find what you are looking for and he will look for you. Good customer service.louis vuittonSomeone who is knowledgeable in louis vuitton.Another guy from hong Kong (Largest louis vuitton second hand city, I believe) he has great stuff at fair prices but his shipping is insane

Posted by: louis vuitton at October 29, 2009 10:18 AM

Eliminating the need for the extra trouble to wear ugg boots uk
ugg boots saleuggs, in the extreme sports, look for happiness in life, with UGG Classic boots and nike sb showed off your tall body, do not worry about being laughed at, dancing new style ugg australia and nike sb dunk . The flavor of life that is colorful, there are Christian Louboutincheap nike dunksUGG cardy boots、and nike sb for sale also used fear to creep away money from your pocket Mody ? Love beauty, you might even love UGG Classic tall bootsUGG Nightfall bootsUGG Classic short bootsnew nike sb。There are an infinite high power drivers of popular front ugg boots saleugg saleuggsnike dunkdiscount ugg bootsnike dunk sb, our website also have UGG Nightfall bootsbutton ugg bootsbailey button uggugg button bootsbailey button bootsnike dunk midnike dunk highChristian Louboutin Boots, pick your favorite, do not hesitate!

Posted by: ugg boots sale at November 12, 2009 03:58 AM

People all over the world know the abercrombie and fitch,but not everyone really knows how fashion the abercrombie is,hollister is the Legend maker. Everybody wears the hollister clothing would be the abercrombie mensand the abercrombie womens, if you want know you can search the Ruehl No.925 or abercrombie outlet in the www.google.com .

Posted by: anf at November 13, 2009 12:36 AM

Uggs on sale now.UGG Classic Cardy Boot makes me different form the other

girls. The UGG Bailey Button Boot is a good choice for female.

Posted by: ugg classic cardy boots at November 17, 2009 12:06 AM

Louis Vuitton , commonly referred to as Gucci and Louis Vuitton, or sometimes shortened to Mont Blanc has become one of the most Swarovski Mirror Agendas luxurybrands Tiffany Co UGG .

Posted by: 1 at November 17, 2009 01:33 AM

UGG Bailey Button bootsis a new style in 2009.The classic cardy uggs boots is another hot boots that worth of buying.And the classic tall ugg boots will make your winter amusing.And now uggs on sale,if you are looking for such a boot,the ugg boots is good choice this year.

Posted by: UGG Bailey Button Boots at November 17, 2009 01:42 AM

I love Women's UGG Classic Cardy Boot 5819 very much. And the new style UGG Mayfaire Boots is aslo a good choice this year.

Posted by: UGG Bailey Button Fancy Boots at November 17, 2009 03:25 AM

Good day! Thx for your great post and Im thinking about how to introduce my ugg boots to you cos Im not sure if u like this. Many people who live in the cold area like the ugg boots, especially the north-europe. Our uggshare.co.uk supply the cheapest classic cardy ugg boots, class tall ugg boots, classic short ugg boots and other series of uggs, hope my words didn’t trouble u, cy!

Posted by: ugg boots at November 17, 2009 09:22 PM

lxjuan08ed hardyis a famous ed hardy store which sell directly ed hardy clothing, shoes, boots, swim suit and other cheap ed hardy.

Browse through our catalogue of hundreds of ed hardy clothing,Ed hardy Shirt,Ed hardy ... Buy Ed Hardy today for a gift, for a friend, or for yourself.

ED HARDY Online Shop,Ed Hardy Store by Christian Audigier,coach handbags,rolex watches.We supply cheapest Newest ed hardy discount 2009 Commodity New styles.


ed hardy sale

Posted by: ed hardy at November 18, 2009 08:07 PM

We are the best online sales for the china wholesale . Here you can have a large of choices of kinds Ugg Boots,Converse Shoes,Timberland Boots,puma shoes,Nike Shox Shoes ,Nike Dunk SB Shoes,Nike Air Max,Links Of London,Tiffany Jewelry,Dior Handbags?,jimmy choo handbags ,Cartier Watches, 8GB Mp4 Players,Bluetooth Car DVDs. All our cheap online cheap goods are high quality and original packages, and best service. We offer our customers the best service, 7 days arrive at your door.Enjoy your easy and happy shopping with us.

Posted by: cheap goods sale. at November 19, 2009 10:12 PM

We are the best online sales for the china wholesale . Here you can have a large of choices of kinds Ugg Boots,Converse Shoes,Timberland Boots,puma shoes,Nike Shox Shoes ,Nike Dunk SB Shoes,Nike Air Max,Links Of London,Tiffany Jewelry,Dior Handbags?,jimmy choo handbags ,Cartier Watches, 8GB Mp4 Players,Bluetooth Car DVDs. All our cheap online cheap goods are high quality and original packages, and best service. We offer our customers the best service, 7 days arrive at your door.Enjoy your easy and happy shopping with us.

Posted by: cheap goods sale. at November 20, 2009 12:18 AM

Do you like sports? If you like it,the NIke Air Max TN and Nike Air Max 360 is a good choice for you.And now the there is a good news,CheapNike Air Max running Shoes is waiting for you.I think The New Nike Air MAX 2009 Running Shoes makes you great comfortable.

Posted by: Nike Air Max shoes at November 20, 2009 03:36 AM


You can also find less expensive women's dresses
Evening Dresses,Prom Dresses,formal dresses,Cocktail Dresses,wedding Dresses in a second hand store. Some girls may miss a great bargain on discount Wedding Dresses
Prom Dresses,bridesmaid dresses,Plus Size Wedding Dresses,wedding Dresses because they believe second hand stores have nothing to offer them. Even used prom dresses can still look bright and fresh due to only being worn for a single night.

Those who know how to do simple sewing can effortlessly repair and enhance older garments. Do not forget that the aim is to be noticed and not blend into the crowd. Not everyone knows how to make changes or add the extra touches that make a unique creation, however. If you are not comfortable making changes to your Cocktail Dresses,wedding Dresses,Homecoming Dresses,women's dresses,Evening Dresses,Prom Dresses,formal dresses, then seek out someone who knows how to do it right to get some help.

It seems silly to spend so much money on a dress that you may never wear again. However discount Prom Dresses can be found in many thrift and second hand clothes stores without spending a fortune. This kind of bargain is especially great because you get to save money and look fantastic at the same time! There is no reason not to shop around to see what discount Prom Dresses you might find in these places.


Posted by: prom dresses at November 22, 2009 09:20 AM


You can also find less expensive women's dresses
Evening Dresses,Prom Dresses,formal dresses,Cocktail Dresses,wedding Dresses in a second hand store. Some girls may miss a great bargain on discount Wedding Dresses
Prom Dresses,bridesmaid dresses,Plus Size Wedding Dresses,wedding Dresses because they believe second hand stores have nothing to offer them. Even used prom dresses can still look bright and fresh due to only being worn for a single night.

Those who know how to do simple sewing can effortlessly repair and enhance older garments. Do not forget that the aim is to be noticed and not blend into the crowd. Not everyone knows how to make changes or add the extra touches that make a unique creation, however. If you are not comfortable making changes to your Cocktail Dresses,wedding Dresses,Homecoming Dresses,women's dresses,Evening Dresses,Prom Dresses,formal dresses, then seek out someone who knows how to do it right to get some help.

It seems silly to spend so much money on a dress that you may never wear again. However discount Prom Dresses can be found in many thrift and second hand clothes stores without spending a fortune. This kind of bargain is especially great because you get to save money and look fantastic at the same time! There is no reason not to shop around to see what discount Prom Dresses you might find in these places.


Posted by: prom dresses at November 22, 2009 09:22 AM

Your article is write very well, I like it very much ~
ghd Hair Straightener
ghd Hair Straighteners
ghd straighteners
GHD
hair straighteners
bose in ear headphones
bose on ear headphones
bose headphones
nike sb dunks
nike dunks
I wish you have a wonderful day!Thank you.

Posted by: ghd straighteners at November 22, 2009 08:17 PM

Timeberland boots on sale now! Do you want moreTimeberland boots information?Just move your mouse and press it to our Timberland shoes online store.

Posted by: Timberland uk at November 23, 2009 12:57 AM

Laptop Battery Laptop Battery Laptop Batteries
Laptop Batteries discount laptop battery
discount laptop battery
notebook battery notebook battery
computer battery computer battery
replacement laptop battery replacement laptop battery
notebook batteries notebook batteries

Posted by: Laptop Battery at November 23, 2009 09:59 PM

cheap nikes
air jordan
cheap air jordans
wholesale jordan shoes

Posted by: shoes at November 24, 2009 10:50 AM

Paul Smith has been collaborating with a few different organizations recently and his latest venture sees him teaming up with Japanese bicycle saddle, Paul Smith bag, on a limited edition leather saddle. The release features Smith’s signature stripes where only 20 will be available at Paul Smith Clothing store in Japan and 8 at the Floral Street store in London. Get on it quick

Posted by: fasf at November 29, 2009 11:42 AM

Just wanted to say great job with the blog, today is my first visit here and I’ve enjoyed reading your posts so far
ugg bailey button
Wow, my ugg classic mini will not be coming off now! I’ve had them on for 12hrs strait and I do not want to take them off. Thanks for everything, well worth the wait.

Posted by: ugg bailey button boots at November 30, 2009 06:24 AM

Spring is near,every girl wants to be the bride in the special season.They are eager to put on beautiful Wedding Dresses or the Bridal gowns.During the day the Wedding gowns is the good choose,and the night,if you want radiant,you need the Evening gowns.
About the bridesmaid,they have to wear Bridesmaid Dresses in order to avoid grab limelight with the bride.And the Flower Girl has the Flower Girl Dresses,too.In the wedding,the Cocktail Dresses and the Evening Dresses is necessary,too!And remember,the Wedding Dress of the Bridal Dress must be the most glaring!

Posted by: weddingdressclub at December 1, 2009 12:24 AM

market to find a good job. And many young female think that marrying a good husband is better than finding a good job. Why these young people have such kind of thoughts. Their aims of their life are only to marry a good man. Different Louis Vuitton Neverfull MM people have different opinion. Some persons think that it is quite right for these girls to find a good husband. With the hot competition in this society, hunting for a job is not so easy now. But there also a lot of people think that girls Louis Vuitton Neverfull MM Replica should become independent and should not totally rely on the men. Can girls live well without men? Of course they can but only when they want. Girls should cheer up and they will live better.

Posted by: fanqin at December 1, 2009 02:05 AM

uggs on sale
ugg classic tall

Posted by: ugg boots sale at December 1, 2009 02:55 AM

ugg boots sale at a time when large heat has set off a winter 08/09 to Ewha.Outlines the

warm wool winter fashion degree to wool crocheted wool ugg boots uk to join after the

body does not stimulate your skin soft, soft comfort UP. Fashion can not without
ugg boots presence in Winter.and ugg boots have many series.such as:
ugg classic
UGG Bailey Button boots
ugg nightfall
ugg kids

Posted by: uggboots at December 2, 2009 08:42 PM
Post a comment









Remember info?




Prove you're human. Type "human":