If you were within your inspection period, which is commonly 10 days here in the Kansas City market, then you should be able to cancel and get your EMD refunded to you. Did you buy the home as an investor or owner occupant? If you were financing the home, were you approved for a Conventional or FHA loan?
By the way, this sounds exactly like my house. We discovered broken pipes when we turned the water on for the inspection. We backed out of the contract, but the bank came back to us saying "what will it take"? We asked them to repair the pipes and knock off another $10K off the purchase price...they did it. We now have the home of our dreams.....actually it was a joke in our house...we call it the "House of Broken Pipe Dreams". Hahaha!
If you couldn't care less about the house, or aren't sure you want to deal with any other problems that may come up, then yes, you can get out of the contract based on inspection issues.