The app I'm working on's code is basically garbage.
It's got to the point where it's become almost impossible to work on and even though it's nearly finished I've made my mind up to do a rewrite. At least I'll end up with something which I can be proud of in the end, which is important since this is more of a portfolio piece than a game I'm looking to make a buck off of.
However I'm really not sure how I can improve on what I've got. Maybe someone can help?
The game is a variation on the board game Risk (very similar to the flash game Dicewars). Where you fight against the AI or other human players to gain control of all the regions in an island.
The island generation makes each region an instance of a class which keeps track of the units in that region (which are clumsily stored on a separate layer), it's adjacent regions, and the team which controls it. The units are an instance of another class, which keeps track of the team it belongs to, and which region it's in right now. There are a set of variables floating around which keep track of which players turn it is, which 'stage' of the turn it is (placing units, attacking, ect.). These are used in what is essentially a series of nested if statements at the start of a turn which will call methods to take care of the turn depending on if it's an ai player or a human player, allocating some units which can be placed.
Even that doesn't properly tell the story of all the randomly named variables which do things I've long forgotten, or the 800 lines of 'misc.' methods....
I'm sure there's a clever way to structure this whole thing so everything can be all neat and tidy. The whole thing is in obj-c and cocos2d (An ios framework, takes care of simple stuff like loading and unloading images, animations, so you don't have to touch that nasty opengl.) if that makes any difference.
I've heard trying to have a clear model, separate from the visuals, is a good idea. However that's kinda hard when it's split up into 40+ regions divided into 4-5 civilisations.
Thanks in advance!

-Oisin