title: Algorithm to solve dots and lines problem?
body: <p>This is a classical game. Thought of explaining the game in my own words, But wiki does it better,</p>
  
  <p><a href="http://en.wikipedia.org/wiki/Dots_and_Boxes" rel="nofollow">http://en.wikipedia.org/wiki/Dots_and_Boxes</a></p>
  
  <p>I am trying to create this game as 2 player game, so no AI is required as of now.</p>
  
  <p>But confused as to what data structure and Algorithm to use,
  I am saving all dots as co-ordinates in an array,
  e.g.
  [x1,y1,x2,y2,x3,y3,x4,y4,....]
  Where x1,y1 makes a pair and co-ordinates,    </p>
  
  <p>I am using java(Android), What is the better way to store co-ordinates ?<br>
  Above method seems too basic and can complicate things later.    </p>
  
  <p>Planning on array of objects, where each object holds x,y co-ordinates and some other info<br>
  in the object.   </p>
  
  <p>What algorithm I should apply to check for cycles, i.e. to know that,<br>
  move by a player has closed the points. Is this a graph problem?   </p>
  
  <p>Any hints on where I have to look for solving this kind of a problem.  </p>
  
  <p>PS: This is a 2 player game as of now, so not worried about Computer move,<br>
  but more concerned about deciding whether the last move has connected the points<br>
  (basically created a cycle? , closed box)  </p>
  
  <p>I checked this,<br>
  <a href="http://en.wikipedia.org/wiki/Flood_fill" rel="nofollow">http://en.wikipedia.org/wiki/Flood_fill</a></p>
  
  <p>something similar to that I should do I guess.</p>