Commits

heiditupper committed fcd8c00

Beginning to merge Java code with old C++.

Comments (0)

Files changed (18)

+#include <iostream>
+#include <cstdlib>
+#include <stdio.h>
+#include <SDL.h>
+
 #include "stdafx.h"
 #include "include/bezier.h"
 #include "include/draw.h"
 //#include "include/textbox.h"//this is not necessary right now.
-#include <SDL.h>
-#include <iostream>
-#include <cstdlib>
-#include <stdio.h>
 
 //Main Constructor.  Sets up a game by allocating memory.
 Game::Game(bool initial_turn, bool mesier_game, int num_nodes, SproutClips * clips){
   this->gameWinState = 0; //Sets the game to no victory
   this->mesier = mesier_game; //Set Mesier.
   this->turn = initial_turn; //Set initial turn.
-  this->count = num_nodes; //Set number of nodes.
-  nodeNumbers = count; //Tell it how many nodes the game has
+  this->count = num_nodes; //Set number of nodes.
+
+  this->nodeNumbers = count; //Tell it how many nodes the game has
+
+  this->nextAvailNode = -1; // No free nodes searched for yet.
 
   // create the TextBox
 //  SDL_Color color = {0,0,0};
 //  Point boxPlace = {205,4};
-//  text = new TextBox(clips->font, color, TEXTBOX_TYPE_MOVE, boxPlace, this);
+//  text = new TextBox(clips->font, color, TEXTBOX_TYPE_, boxPlace, this);
 
   this->sproutClips = clips;
 
     system("PAUSE");
     exit(0);
   }else{ //It worked...
-    for(int i = 0; i < 4 * count; i++) //Now we allocate memory to each pointer allocated before.
+    for(int i = 0; i < 4 * count; i++) //Now we allocate memory to each pointer allocated before. (second dimension)
     {
       this->connectable[i] = NULL; //Initialize.
       this->connectable[i] = (int *)malloc(4 * count * sizeof(int)); //Allocate 4*count ints to each pointer established before.
-      if(this->connectable[i] == NULL) //If one failes we have to quit.
+      if(this->connectable[i] == NULL) //If one fails, we have to quit.
       {
         std::cout << "Out of memory!" << std::endl;
         system("PAUSE");
     }
     this->nodes[i] = new Sprout(i, -1, -1, sproutClips, nodes, this);
   }
+
 }
 
 //Game copy constructor.  Exactly the same as the main constructor except it copies data from a game reference passed to it.
 Game::Game(Game *current){
   this->mesier = current->mesier;
   this->turn = current->turn;
-  this->count = current->count;
+  this->count = current->count;
+  this->nextAvailNode = current->nextAvailNode;
 
   //text = current->text;
 
   fputs("\n", fle);
 }
 
-void Game::move(char *move){
-  int to = -1, from = -1, creates = -1, near = -1, error = 0;
-  bool clockwise = true;
-  std::list<int> encap;
+void Game::move(char *move){
+  // Currently obsolete.
 
-  error = this->parsemove(move, &from, &to, &creates, &near, &clockwise, &encap);
-	this->parseerror(error);
-
-	std::cout << "Move: " << move << std::endl;
-	std::cout << from << " Creates " << creates << " To " << to;
-	if(near != -1)
-		std::cout << " Near " << near;
-	std::cout << std::endl;
-
-	if(error == 0)
-    this->applyMove(from, to, creates, encap, clockwise, near);
-  else
-    std::cout << "Error: " << error << std::endl;
+//  int to = -1, from = -1, creates = -1, near = -1, error = 0;
+//  bool clockwise = true;
+//  std::list<int> encap;
+//
+//  error = this->parsemove(move, &from, &to, &creates, &near, &clockwise, &encap);
+//	this->parseerror(error);
+//
+//	std::cout << "Move: " << move << std::endl;
+//	std::cout << from << " Creates " << creates << " To " << to;
+//	if(near != -1)
+//		std::cout << " Near " << near;
+//	std::cout << std::endl;
+//
+//	if(error == 0)
+//    this->applyMove(from, to, creates, encap, clockwise, near);
+//  else
+//    std::cout << "Error: " << error << std::endl;
 }
 
 int Game::get_connected(int from, int to){

LoadingScreen.cpp

 //Constructor for Loading screen
 LoadingScreen::LoadingScreen(void)
 {
-  loadingWait = IMG_Load( "images/loadingscreen/front3.png" );
+  loadingWait = IMG_Load( "images/loadingscreen/front01.png" );
 }
 
 //Music not implemented in this verion
 #include "include/LoadingScreen.h"
 #include "include/Sprout.h"
 //#include "include/textbox.h" //not currently being used
-#include "SDL_ttf.h"
+#include "SDL_ttf.h"
+#include "drawLine.h"
 
 // Define Game States
 enum GameState{ GAME_STATE_LOADING,
       GAME_STATE_PLAY,
       GAME_STATE_QUIT};
 
-struct Move
-{
-  int from;
-  int to;
-  int creates;
-  Sprout * newSprout;
-  Bezier * toCurve;
-  Bezier * fromCurve;
-};
+//struct Move
+//{
+//  int from;
+//  int to;
+//  int creates;
+//  Sprout * newSprout;
+//  Bezier * toCurve;
+//  Bezier * fromCurve;
+//};
 
 using namespace std;
 
 Button * PvE;//player versus computer
 Button * Quit;//quit sprouts
 
-Move * move;
+//Move * move;
 // End more globals
+
+// these are defined in init()
+Uint32 sdl_red;
+Uint32 sdl_green;
+Uint32 sdl_blue;
+Uint32 sdl_black;
+Uint32 sdl_white;
+Uint32 sdl_yellow;
+Uint32 sdl_orange;
+Uint32 sdl_gray;
+
+drawLine trail; // this class draws the trail, keeps track of what's been drawn, and detects collisions.
+
 
 void setSproutClips()
 {
   textError     = TTF_RenderText_Blended( font, " ", textColor);
   text1         = TTF_RenderText_Blended( font, "1", textColor);
   text2         = TTF_RenderText_Blended( font, "2", textColor);
-  textOptions   = TTF_RenderText_Blended( font, "Press F2 to Restart or ESC to Return to the Menu.", textColor);
-
+  textOptions   = TTF_RenderText_Blended( font, "Press F2 to Restart or ESC to Return to the Menu.", textColor);
+
+  // since these aren't const, remember not to change them!
+  sdl_black = SDL_MapRGB(screen->format, 0, 0, 0);
+  sdl_white = SDL_MapRGB(screen->format, 255, 255, 255);
+  sdl_red  = SDL_MapRGB(screen->format, 255, 0, 0);
+  sdl_green  = SDL_MapRGB(screen->format, 0, 255, 0);
+  sdl_blue  = SDL_MapRGB(screen->format, 0, 0, 255);
+  sdl_yellow  = SDL_MapRGB(screen->format, 255, 255, 0);
+  sdl_orange  = SDL_MapRGB(screen->format, 255, 165, 0);
+  sdl_gray  = SDL_MapRGB(screen->format, 190, 190, 190);
+
+  trail.reset(screen);
+
   //If everything initialized fine
   //return true;
   cout << "Ready to GO!!" << endl;
   int i = 0;
   for (i=0; g->nodes[i] != NULL; i++)
   {
-    // do nothing finding the
+    // do nothing until we find an empty node.
   }
-
-  if (move != NULL)
-  {
-    if (move->fromCurve != NULL)
-      move->fromCurve->draw(screen);
-    if (move->toCurve != NULL)
-      move->toCurve->draw(screen);
-  }
+
+
+// TBD
+//  if (move != NULL)
+//  {
+//    if (move->fromCurve != NULL)
+//      move->fromCurve->draw(screen);
+//    if (move->toCurve != NULL)
+//      move->toCurve->draw(screen);
+//  }
 
   for (int j = 0; j <= i; j++)
     for (int k = 0; k <= i; k++)
     g->nodes[i]->draw(screen);
     i++;
   }
-
-  if (move != NULL)
-    if (move->newSprout != NULL)
-      move->newSprout->draw(screen);
+
+//TBD
+//  if (move != NULL)
+//    if (move->newSprout != NULL)
+//      move->newSprout->draw(screen);
 
   return 1;
 }
 
 void clearMove(void)
 {
-  if (move != NULL)
-  {
+//  if (move != NULL)
+//  {
     // set the colors back to normal for the nodes
-    if (move->to != -1)
-      g->nodes[move->to]->removeConnection();
-    if (move->from != -1)
-      g->nodes[move->from]->removeConnection();
+    if (trail.startNode != -1)
+      g->nodes[trail.startNode]->removeConnection();
+    if (trail.endNode != -1)
+      g->nodes[trail.endNode]->removeConnection();
+
+    trail.terminateDrawing(-1,-1,g->nodes);
 
     // Delete the new objects created
-    if (move->toCurve != NULL)
-      delete move->toCurve;
-    if (move->fromCurve != NULL)
-      delete move->fromCurve;
-    if (move->newSprout != NULL)
-      delete move->newSprout;
+// TBD
+//    if (move->toCurve != NULL)
+//      delete move->toCurve;
+//    if (move->fromCurve != NULL)
+//      delete move->fromCurve;
+//    if (move->newSprout != NULL)
+//      delete move->newSprout;
+//TBD
+    // Set values back to base values
+//    move->to        = -1;
+//    move->from      = -1;
+//    move->toCurve   = NULL;
+//    move->fromCurve = NULL;
+//    move->newSprout = NULL;
 
-    // Set values back to base values
-    move->to        = -1;
-    move->from      = -1;
-    move->toCurve   = NULL;
-    move->fromCurve = NULL;
-    move->newSprout = NULL;
-
-    for (move->creates = 0; g->nodes[move->creates] != NULL; move->creates++)
+    for (g->nextAvailNode = 0; g->nodes[g->nextAvailNode] != NULL; g->nextAvailNode)
     {
-      // find the first null node
+      // find the first null node index, save it in g->nextAvailNode.
     }
-  }
+  //}
 }
 
 void newGame(bool player, bool mesier, int nodes)
 {
   delete g;
-  g = new Game(player,mesier,nodes,&sproutClips);
+  g = new Game(player,mesier,nodes,&sproutClips);
+  trail.reset(screen);
   clearMove();
   if (g == NULL)
   {
-    cout << "Error game not created completly" << endl;
+    cout << "Error game not created completely." << endl;
   }
 }
-
+
+
+// ### TBD
+// sendMove() was apparently unused???
 void sendMove()
 {
   // Make sure its a valid move
-  if (move != NULL && move->newSprout != NULL)
-  {
-    char temp[50];
-    sprintf(temp,"%d(%d)%d",move->to+1,move->creates+1,move->from+1);
-    g->move(temp);
-  }
-  if (g->nodes[move->creates] != NULL)
-  {
-    Point temp = move->newSprout->getPoint();
-    g->nodes[move->creates]->setPoint(temp.x, temp.y);
-    if(g->connection[move->to][move->creates] != NULL)
-      g->connection[move->to][move->creates]->adjustCoord(CURVE_START,temp.x,temp.y);
-    if(g->connection[move->creates][move->from] != NULL)
-      g->connection[move->creates][move->from]->adjustCoord(CURVE_END,temp.x,temp.y);
-    clearMove();
-  }
+//  if (move != NULL && move->newSprout != NULL)
+//  {
+//    char temp[50];
+//    sprintf(temp,"%d(%d)%d",move->to+1,move->creates+1,move->from+1);
+//    g->move(temp);
+//  }
+  // what check goes here?###
+  if(trail.startNode != -1 && trail.endNode != -1)
+  {
+    for (g->nextAvailNode = 0; g->nodes[g->nextAvailNode] != NULL; g->nextAvailNode)
+    {
+      // find the first null node index, save it in g->nextAvailNode.
+    }
+    g->applyMove(trail.startNode, trail.endNode, trail.bestx, trail.besty);
+  }
+
+
+//  if (g->nextAvailNode != -1 && g->nodes[g->nextAvailNode] != NULL)
+//  {
+//    Point temp = move->newSprout->getPoint();
+//    g->nodes[g->nextAvailNode]->setPoint(temp.x, temp.y);
+//    if(g->connection[trail.endNode][g->nextAvailNode] != NULL)
+//      g->connection[trail.endNode][g->nextAvailNode]->adjustCoord(CURVE_START,temp.x,temp.y);
+//    if(g->connection[g->nextAvailNode][trail.startNode] != NULL)
+//      g->connection[g->nextAvailNode][trail.startNode]->adjustCoord(CURVE_END,temp.x,temp.y);
+//    clearMove();
+//  }
 }
 int main(int argc, char* argv[])
 {
   Quit = new Button(Quitpoint, "Quit",font);
 
   g = new Game(false,true,4,&sproutClips);//generates 4 sprouts for a new game.
-
-  move = new Move;
-  for (move->creates = 0; g->nodes[move->creates] != NULL; move->creates++)
+  trail.reset(screen);
+  //move = new Move;
+  for (g->nextAvailNode = 0; g->nodes[g->nextAvailNode] != NULL; g->nextAvailNode++)
   {
     // find the first null node
   }
-  move->to        = -1;
-  move->from      = -1;
-  move->toCurve   = NULL;
-  move->fromCurve = NULL;
-  move->newSprout = NULL;
+// TBD
+//  move->to        = -1;
+//  move->from      = -1;
+//  move->toCurve   = NULL;
+//  move->fromCurve = NULL;
+//  move->newSprout = NULL;
 
 
   if (Draw())
 
       if (event.type == SDL_MOUSEMOTION)
       {
-        switch(gameState)
+        //switch(gameState)
+        //{
+        if(gameState ==  GAME_STATE_PLAY)
         {
-          case GAME_STATE_PLAY:
-            if (move->toCurve != NULL)
+            /*if (move->toCurve != NULL)
               move->toCurve->setCurve(event.button.x,event.button.y);
             if (move->fromCurve != NULL)
               move->fromCurve->setCurve(event.button.x,event.button.y);
             if (move->newSprout != NULL)
-              move->newSprout->setPoint(event.button.x,event.button.y);
+              move->newSprout->setPoint(event.button.x,event.button.y);*/
+            if(trail.isDraggingNow())
+            {
+              trail.connect(event.motion.x, event.motion.y, g->nodes);
+            }
 
             int i = 0;
             while (g->nodes[i] != NULL)
             {
               if (g->nodes[i]->getState() != MOUSE_CLICK)
-                if (g->nodes[i]->isMouseOver(event.button.x,event.button.y))
+                if (g->nodes[i]->isMouseOver(event.motion.x,event.motion.y))
                   g->nodes[i]->setState(MOUSE_OVER);
                 else
                   g->nodes[i]->setState(MOUSE_NORMAL);
               i++;
             }
         }
-      }
+      } // mouse motion
 
       if (event.type == SDL_MOUSEBUTTONDOWN)
       {
           {
             // We are playing a game
             case GAME_STATE_PLAY:
-              found = false;
+              if (!trail.isDraggingNow())
+              {
+              //found = false;
 //              if (g->text->isMouseover(event.button.x,event.button.y))
 //              {
 //                g->text->setState(TEXTBOX_FOCUS);
 //              else
 //                g->text->setState(TEXTBOX_NO_FOCUS);
 
-              while (g->nodes[i] != NULL)
-              {
-                if (g->nodes[i]->isMouseOver(event.button.x,event.button.y))
-                {
-                  if (move->to == -1)
+                  while (g->nodes[i] != NULL)
                   {
-                    if (g->nodes[i]->getConnections() < 3)
+                    if (g->nodes[i]->isMouseOver(event.button.x,event.button.y))
                     {
-                      move->to = i;
-                      g->nodes[i]->setState(MOUSE_CLICK);
-                      move->toCurve = new Bezier(g->nodes[i]->getPoint());
-                    }
-                  }
-                  else if (move->from == -1)
-                  {
-                    if (g->nodes[i]->getConnections() < 3)
-                    {
-                      for (move->creates = 0; g->nodes[move->creates] != NULL; move->creates++)
-                      {
-                        // find the first null node
-                      }
-                      move->from = i;
-                      g->nodes[i]->setState(MOUSE_CLICK);
-                      move->fromCurve = new Bezier(g->nodes[i]->getPoint());
-                      move->newSprout = new Sprout(move->creates, event.button.x, event.button.y, &sproutClips);
-                    }
-                  }
-                  found = true;
-                  break;
-                }
-                i++;
-              }
+                        if (g->freeConnections(i) < 3)
+                        {
+                          // We have clicked on an available node; start drawing lines from it.
+                          g->nodes[i]->setState(MOUSE_CLICK);
+                          //move->toCurve = new Bezier(g->nodes[i]->getPoint());
+
+                          trail.mousePressed(event.button.x, event.button.y, g->nodes);
+                        }
+                      break;
+                     } // if
+                    i++;
+                   } // while
 
-              // The click is not over any sprouts or the text box
-              if (move->newSprout != NULL && !found)
-              {
-                // Make sure its not on the top bar
-                if (event.button.y < 30)
-                  break;
+              } // if (!trail.isDraggingNow())
+              else // otherwise, we are dragging still, so continue drawing
+              {
+                //if (currently_drawing)
+                //{
+                  //int i = event.button.x;
+                  //int j = event.button.y;
+
+                  trail.connect(event.button.x, event.button.y, g->nodes);
+                //}
+
+              }
 
-                // Should be good to try to create a new move
-                sendMove();
-              }
               break;
             // It is the start screen
             case GAME_STATE_START:
               break;
           }
         }
+      } // if (mouse down event)
+
+      if(event.type == SDL_MOUSEBUTTONUP && gameState == GAME_STATE_PLAY)
+      {
+        if(trail.isDraggingNow() && event.button.button == SDL_BUTTON_LEFT) // i.e. if we let up the button while we were still drawing the connection...
+        {
+          // ... then abort
+          trail.terminateDrawing(event.button.x,event.button.y,g->nodes);
+          trail.beingDragged = false;
+          trail.drawing=false;
+        }
       }
     }
   }
 #include "stdafx.h"
 
 #include <cmath>
-
+
 #include "include/game.h"
 #include "include/Sprout.h"
 #include "SDL_ttf.h"
 		<Unit filename="Game.cpp" />
 		<Unit filename="LoadingScreen.cpp" />
 		<Unit filename="Main.cpp" />
-		<Unit filename="ReadMe.txt" />
 		<Unit filename="Sprout.cpp" />
 		<Unit filename="applymove.cpp" />
 		<Unit filename="bezier.cpp" />
 		<Unit filename="button.cpp" />
 		<Unit filename="checkWin.cpp" />
 		<Unit filename="draw.cpp" />
+		<Unit filename="drawLine.cpp" />
+		<Unit filename="drawLine.h" />
 		<Unit filename="include\LoadingScreen.h" />
 		<Unit filename="include\Sprout.h" />
 		<Unit filename="include\bezier.h" />
 		<Unit filename="include\button.h" />
 		<Unit filename="include\draw.h" />
 		<Unit filename="include\game.h" />
-		<Unit filename="include\textbox.h" />
 		<Unit filename="include\timer.h" />
 		<Unit filename="parse.cpp" />
 		<Unit filename="stdafx.cpp" />
 		<Unit filename="stdafx.h" />
-		<Unit filename="textbox.cpp" />
 		<Unit filename="timer.cpp" />
 		<Extensions>
 			<code_completion />

Sprouts Game.depend

 	"draw.h"
 	<string>
 
-1307068218 source:c:\users\robin\desktop\programming\cptr143\sprouts 2011\main.cpp
+1307072174 source:c:\users\robin\desktop\programming\cptr143\sprouts 2011\main.cpp
 	<time.h>
 	"stdafx.h"
 	"include/bezier.h"
 
 1303927130 c:\users\robin\desktop\programming\cptr143\sprouts 2011\include\timer.h
 
+1307404508 source:c:\users\robin\desktop\sprouts 2011\game.cpp
+	<iostream>
+	<cstdlib>
+	<stdio.h>
+	<SDL.h>
+	"stdafx.h"
+	"include/bezier.h"
+	"include/draw.h"
+
+1307404508 c:\users\robin\desktop\sprouts 2011\stdafx.h
+	<iostream>
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\bezier.h
+	"draw.h"
+	"game.h"
+	"SDL_gfxPrimitives.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\draw.h
+	"SDL.h"
+	"SDL_image.h"
+	<string>
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl.h
+	"SDL_main.h"
+	"SDL_stdinc.h"
+	"SDL_audio.h"
+	"SDL_cdrom.h"
+	"SDL_cpuinfo.h"
+	"SDL_endian.h"
+	"SDL_error.h"
+	"SDL_events.h"
+	"SDL_loadso.h"
+	"SDL_mutex.h"
+	"SDL_rwops.h"
+	"SDL_thread.h"
+	"SDL_timer.h"
+	"SDL_video.h"
+	"SDL_version.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_main.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_stdinc.h
+	"SDL_config.h"
+	<sys/types.h>
+	<stdio.h>
+	<stdlib.h>
+	<stddef.h>
+	<stdarg.h>
+	<stdlib.h>
+	<malloc.h>
+	<stddef.h>
+	<stdarg.h>
+	<memory.h>
+	<string.h>
+	<strings.h>
+	<inttypes.h>
+	<stdint.h>
+	<ctype.h>
+	<iconv.h>
+	"begin_code.h"
+	<alloca.h>
+	<malloc.h>
+	<malloc.h>
+	<malloc.h>
+	<stdlib.h>
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_config.h
+	"SDL_platform.h"
+	<stdarg.h>
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_platform.h
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\begin_code.h
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\close_code.h
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_audio.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_endian.h"
+	"SDL_mutex.h"
+	"SDL_thread.h"
+	"SDL_rwops.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_error.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_endian.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_mutex.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_thread.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_mutex.h"
+	"begin_code.h"
+	<process.h>
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_rwops.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_cdrom.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_cpuinfo.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_events.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_active.h"
+	"SDL_keyboard.h"
+	"SDL_mouse.h"
+	"SDL_joystick.h"
+	"SDL_quit.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_active.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_keyboard.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_keysym.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_keysym.h
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_mouse.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_video.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_video.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_rwops.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_joystick.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_quit.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_loadso.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_timer.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_version.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_image.h
+	"SDL.h"
+	"SDL_version.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\game.h
+	<list>
+	"Sprout.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\sprout.h
+	"draw.h"
+	"SDL_ttf.h"
+
+1307404543 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_ttf.h
+	"SDL.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307404542 c:\users\robin\desktop\sprouts 2011\sdl\include\sdl\sdl_gfxprimitives.h
+	<math.h>
+	"SDL.h"
+
+1307408191 source:c:\users\robin\desktop\sprouts 2011\loadingscreen.cpp
+	"stdafx.h"
+	"include/draw.h"
+	"include/LoadingScreen.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\loadingscreen.h
+	"draw.h"
+	<string>
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\main.cpp
+	<time.h>
+	"stdafx.h"
+	"include/bezier.h"
+	"include/button.h"
+	"include/LoadingScreen.h"
+	"include/Sprout.h"
+	"SDL_ttf.h"
+	"drawLine.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\button.h
+	"../stdafx.h"
+	"draw.h"
+	<string>
+	"../SDL/SDL_ttf.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\sprout.cpp
+	"stdafx.h"
+	<cmath>
+	"include/game.h"
+	"include/Sprout.h"
+	"SDL_ttf.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\applymove.cpp
+	"stdafx.h"
+	"include/Sprout.h"
+	"include/bezier.h"
+	<list>
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\bezier.cpp
+	"stdafx.h"
+	"include/draw.h"
+	"include/bezier.h"
+	"SDL_gfxPrimitives.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\button.cpp
+	"stdafx.h"
+	"include/button.h"
+	"include/draw.h"
+	"SDL_gfxPrimitives.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\checkwin.cpp
+	"stdafx.h"
+	"include/Sprout.h"
+	"include/bezier.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\draw.cpp
+	"stdafx.h"
+	"include/draw.h"
+	<string>
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\parse.cpp
+	"stdafx.h"
+	<stack>
+	<math.h>
+	"include/game.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\stdafx.cpp
+	"stdafx.h"
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\timer.cpp
+	"stdafx.h"
+	"SDL.h"
+	"include/timer.h"
+
+1307404530 c:\users\robin\desktop\sprouts 2011\include\timer.h
+
+1307404508 source:c:\users\robin\desktop\sprouts 2011\drawline.cpp
+	<iostream>
+	<cstdlib>
+	<stdio.h>
+	"SDL.h"
+	"SDL_gfxPrimitives.h"
+	"include/Sprout.h"
+	"drawLine.h"
+
+1307404508 c:\users\robin\desktop\sprouts 2011\drawline.h
+	"SDL.h"
+	"include/draw.h"
+
+1307313760 source:d:\coding\sprouts 2011\loadingscreen.cpp
+	"stdafx.h"
+	"include/draw.h"
+	"include/LoadingScreen.h"
+
+1303927130 d:\coding\sprouts 2011\stdafx.h
+	<iostream>
+
+1307366409 d:\coding\sprouts 2011\include\draw.h
+	"SDL.h"
+	"SDL_image.h"
+	<string>
+
+1303927116 d:\coding\sprouts 2011\sdl\include\sdl\sdl.h
+	"SDL_main.h"
+	"SDL_stdinc.h"
+	"SDL_audio.h"
+	"SDL_cdrom.h"
+	"SDL_cpuinfo.h"
+	"SDL_endian.h"
+	"SDL_error.h"
+	"SDL_events.h"
+	"SDL_loadso.h"
+	"SDL_mutex.h"
+	"SDL_rwops.h"
+	"SDL_thread.h"
+	"SDL_timer.h"
+	"SDL_video.h"
+	"SDL_version.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_main.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_stdinc.h
+	"SDL_config.h"
+	<sys/types.h>
+	<stdio.h>
+	<stdlib.h>
+	<stddef.h>
+	<stdarg.h>
+	<stdlib.h>
+	<malloc.h>
+	<stddef.h>
+	<stdarg.h>
+	<memory.h>
+	<string.h>
+	<strings.h>
+	<inttypes.h>
+	<stdint.h>
+	<ctype.h>
+	<iconv.h>
+	"begin_code.h"
+	<alloca.h>
+	<malloc.h>
+	<malloc.h>
+	<malloc.h>
+	<stdlib.h>
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_config.h
+	"SDL_platform.h"
+	<stdarg.h>
+
+1303927116 d:\coding\sprouts 2011\sdl\include\sdl\sdl_platform.h
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\begin_code.h
+
+1303927116 d:\coding\sprouts 2011\sdl\include\sdl\close_code.h
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_audio.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_endian.h"
+	"SDL_mutex.h"
+	"SDL_thread.h"
+	"SDL_rwops.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_error.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_endian.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_mutex.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_thread.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_mutex.h"
+	"begin_code.h"
+	<process.h>
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_rwops.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_cdrom.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_cpuinfo.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_events.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_active.h"
+	"SDL_keyboard.h"
+	"SDL_mouse.h"
+	"SDL_joystick.h"
+	"SDL_quit.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_active.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_keyboard.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_keysym.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_keysym.h
+
+1303927116 d:\coding\sprouts 2011\sdl\include\sdl\sdl_mouse.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_video.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_video.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"SDL_rwops.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_joystick.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_quit.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_loadso.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_timer.h
+	"SDL_stdinc.h"
+	"SDL_error.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927116 d:\coding\sprouts 2011\sdl\include\sdl\sdl_version.h
+	"SDL_stdinc.h"
+	"begin_code.h"
+	"close_code.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_image.h
+	"SDL.h"
+	"SDL_version.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307067854 d:\coding\sprouts 2011\include\loadingscreen.h
+	"draw.h"
+	<string>
+
+1307332366 source:d:\coding\sprouts 2011\sprout.cpp
+	"stdafx.h"
+	<cmath>
+	"include/game.h"
+	"include/Sprout.h"
+	"SDL_ttf.h"
+
+1307371519 d:\coding\sprouts 2011\include\game.h
+	<list>
+	"Sprout.h"
+
+1303927132 d:\coding\sprouts 2011\include\sprout.h
+	"draw.h"
+	"SDL_ttf.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_ttf.h
+	"SDL.h"
+	"begin_code.h"
+	"close_code.h"
+
+1307372048 source:d:\coding\sprouts 2011\applymove.cpp
+	"stdafx.h"
+	"include/Sprout.h"
+	"include/bezier.h"
+	<list>
+
+1303927132 d:\coding\sprouts 2011\include\bezier.h
+	"draw.h"
+	"game.h"
+	"SDL_gfxPrimitives.h"
+
+1303927118 d:\coding\sprouts 2011\sdl\include\sdl\sdl_gfxprimitives.h
+	<math.h>
+	"SDL.h"
+
+1303927128 source:d:\coding\sprouts 2011\bezier.cpp
+	"stdafx.h"
+	"include/draw.h"
+	"include/bezier.h"
+	"SDL_gfxPrimitives.h"
+
+1303927128 source:d:\coding\sprouts 2011\button.cpp
+	"stdafx.h"
+	"include/button.h"
+	"include/draw.h"
+	"SDL_gfxPrimitives.h"
+
+1303927132 d:\coding\sprouts 2011\include\button.h
+	"../stdafx.h"
+	"draw.h"
+	<string>
+	"../SDL/SDL_ttf.h"
+
+1303927132 source:d:\coding\sprouts 2011\checkwin.cpp
+	"stdafx.h"
+	"include/Sprout.h"
+	"include/bezier.h"
+
+1303927128 source:d:\coding\sprouts 2011\draw.cpp
+	"stdafx.h"
+	"include/draw.h"
+	<string>
+
+1303927128 source:d:\coding\sprouts 2011\parse.cpp
+	"stdafx.h"
+	<stack>
+	<math.h>
+	"include/game.h"
+
+1303927130 source:d:\coding\sprouts 2011\stdafx.cpp
+	"stdafx.h"
+
+1303927128 source:d:\coding\sprouts 2011\timer.cpp
+	"stdafx.h"
+	"SDL.h"
+	"include/timer.h"
+
+1303927132 d:\coding\sprouts 2011\include\timer.h
+
+1307372278 source:d:\coding\sprouts 2011\game.cpp
+	<iostream>
+	<cstdlib>
+	<stdio.h>
+	<SDL.h>
+	"stdafx.h"
+	"include/bezier.h"
+	"include/draw.h"
+
+1307375614 source:d:\coding\sprouts 2011\main.cpp
+	<time.h>
+	"stdafx.h"
+	"include/bezier.h"
+	"include/button.h"
+	"include/LoadingScreen.h"
+	"include/Sprout.h"
+	"SDL_ttf.h"
+	"drawLine.h"
+
+1307374892 d:\coding\sprouts 2011\drawline.h
+	"SDL.h"
+	"include/draw.h"
+
+1307375136 source:d:\coding\sprouts 2011\drawline.cpp
+	<iostream>
+	<cstdlib>
+	<stdio.h>
+	"SDL.h"
+	"SDL_gfxPrimitives.h"
+	"include/Sprout.h"
+	"drawLine.h"
+

Sprouts Game.layout

 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 <CodeBlocks_layout_file>
 	<ActiveTarget name="Debug Win32" />
-	<File name="Game.cpp" open="1" top="0" tabpos="9">
-		<Cursor position="718" topLine="17" />
+	<File name="Game.cpp" open="1" top="0" tabpos="11">
+		<Cursor position="1042" topLine="23" />
 	</File>
-	<File name="LoadingScreen.cpp" open="1" top="0" tabpos="2">
-		<Cursor position="297" topLine="9" />
+	<File name="LoadingScreen.cpp" open="1" top="0" tabpos="10">
+		<Cursor position="207" topLine="0" />
 	</File>
-	<File name="Main.cpp" open="1" top="1" tabpos="1">
-		<Cursor position="8760" topLine="287" />
+	<File name="Main.cpp" open="1" top="0" tabpos="1">
+		<Cursor position="12098" topLine="426" />
 	</File>
-	<File name="Sprout.cpp" open="1" top="0" tabpos="3">
-		<Cursor position="0" topLine="0" />
+	<File name="Sprout.cpp" open="1" top="0" tabpos="9">
+		<Cursor position="10473" topLine="312" />
 	</File>
-	<File name="applymove.cpp" open="1" top="0" tabpos="4">
-		<Cursor position="154" topLine="153" />
+	<File name="applymove.cpp" open="1" top="0" tabpos="8">
+		<Cursor position="9031" topLine="302" />
 	</File>
-	<File name="button.cpp" open="1" top="0" tabpos="8">
-		<Cursor position="1065" topLine="52" />
+	<File name="bezier.cpp" open="1" top="0" tabpos="7">
+		<Cursor position="5623" topLine="220" />
 	</File>
-	<File name="draw.cpp" open="1" top="0" tabpos="7">
-		<Cursor position="966" topLine="0" />
+	<File name="button.cpp" open="1" top="0" tabpos="6">
+		<Cursor position="2253" topLine="60" />
 	</File>
-	<File name="include\LoadingScreen.h" open="1" top="0" tabpos="5">
-		<Cursor position="606" topLine="15" />
+	<File name="checkWin.cpp" open="1" top="0" tabpos="5">
+		<Cursor position="1369" topLine="49" />
 	</File>
-	<File name="include\button.h" open="1" top="0" tabpos="10">
-		<Cursor position="440" topLine="11" />
+	<File name="draw.cpp" open="1" top="0" tabpos="4">
+		<Cursor position="1505" topLine="9" />
 	</File>
-	<File name="include\draw.h" open="1" top="0" tabpos="6">
-		<Cursor position="626" topLine="10" />
+	<File name="drawLine.cpp" open="1" top="1" tabpos="2">
+		<Cursor position="140" topLine="0" />
 	</File>
-	<File name="include\textbox.h" open="1" top="0" tabpos="11">
-		<Cursor position="199" topLine="0" />
+	<File name="drawLine.h" open="1" top="0" tabpos="3">
+		<Cursor position="89" topLine="5" />
 	</File>
-	<File name="textbox.cpp" open="1" top="0" tabpos="12">
-		<Cursor position="203" topLine="0" />
+	<File name="include\LoadingScreen.h" open="0" top="0" tabpos="5">
+		<Cursor position="436" topLine="0" />
+	</File>
+	<File name="include\Sprout.h" open="0" top="0" tabpos="10">
+		<Cursor position="2917" topLine="71" />
+	</File>
+	<File name="include\button.h" open="0" top="0" tabpos="10">
+		<Cursor position="658" topLine="7" />
+	</File>
+	<File name="include\draw.h" open="0" top="0" tabpos="6">
+		<Cursor position="552" topLine="3" />
+	</File>
+	<File name="include\game.h" open="0" top="0" tabpos="2">
+		<Cursor position="756" topLine="14" />
+	</File>
+	<File name="parse.cpp" open="0" top="0" tabpos="8">
+		<Cursor position="145" topLine="0" />
 	</File>
 </CodeBlocks_layout_file>
Binary file modified.
 return 0;
 }
 
-bool Game::applyMove(int from, int to, int creates, std::list<int> encapsulated, bool clockwise, int near)
+//bool Game::applyMove(int from, int to, int creates, std::list<int> encapsulated, bool clockwise, int near)
+bool Game::applyMove(int from, int to, int newX, int newY)
 {
 	turn = (turn+1)%2;
 	output_console();
-	this->nodes[creates] = new Sprout(creates, from, to, sproutClips,nodes, this);//creates a new node in the node array
+	this->nodes[nextAvailNode] = new Sprout(nextAvailNode, newX, newY, sproutClips);//creates a new node in the node array
 	nodeNumbers++;
 
   // lets the sprouts know of the additional connections
-  this->nodes[creates]->addConnection();
-  this->nodes[creates]->addConnection();
+  //this->nodes[nextAvailNode]->addConnection();  // The Sprout constructor that takes X and Y coords already sets the color to 2.
+  //this->nodes[nextAvailNode]->addConnection();  // So, the newly created node doesn't need this.
   this->nodes[to]->addConnection();
   this->nodes[from]->addConnection();
 
 
 
+// TBD
+//	if(connection[nextAvailNode][from]<0)//this section handles creating bezier curves in the 4n connection matrix
+//		connection[nextAvailNode][from] = new Bezier(creates,from,this);
+//	else connection[from][creates] = new Bezier(creates,from,this);
+//	if(connection[to][creates]<0)
+//		connection[to][creates] = new Bezier(to,creates,this);
+//	else connection[creates][to]= new Bezier(to,creates,this);
+//
 
-	if(connection[creates][from]<0)//this section handles creating bezier curves in the 4n connection matrix
-		connection[creates][from] = new Bezier(creates,from,this);
-	else connection[from][creates] = new Bezier(creates,from,this);
-	if(connection[to][creates]<0)
-		connection[to][creates] = new Bezier(to,creates,this);
-	else connection[creates][to]= new Bezier(to,creates,this);
+// ### Everything from here on has to do with checking for winning conditions, which is currently not functional.
+//      In any case, I recommend moving it to its own function instead of doing it in applyMove()
 
-
-
-	std::list<int> enregioning;
-	int enregioned = 0;
-
-		for(int i = 0; connectable[i][i]!=-1; i++)//initializes the 'connected' side of the array to zero for the new node?
-	{
-		if(i>creates)
-		{
-			connectable[i][creates] = 0;
-		}
-		else if (creates>i)
-		{
-			connectable[creates][i] = 0;
-		}
-	}
-
-	//this section handles the 'connected' side of the array.
-	if (from>creates)  //creating the connection from the 'from' node to the created node
-	{
-		connectable[from][creates] = 1;
-	}
-  else
-  {
-		connectable[creates][from] = 1;
-	}
-	connectable[from][from]+=1;
-	if (to>creates)  //creating the connection from the 'to' node to the created node.
-	{
-		connectable[to][creates] = 1;
-	}
-  else
-	{
-		connectable[creates][to] = 1;
-	}
-	connectable[to][to]+=1;
-	connectable[creates][creates]=2;
-
-
-
-for (int i = 0;connectable[i][i]!=-1;i++) //this handles the initialization of the 'connectable' side of the array
-  {											//for the created node, taking into consideration the 'near' node.
-	if(near>i)                              //Note, however, that everything else related to enregioning is performed
-	{										//At the bottom of the function
-		if (connectable[i][near])
-		{
-			if(creates>i)
-			{
-			  connectable[i][creates]=1;
-			}
-			else if (creates<i)
-			{
-			  connectable[creates][i]=1;
-			}
-		}
-	}
-	if(i>near)
-	{
-		if (connectable[i][near])
-		{
-			if(i<creates)
-			{
-			  connectable[i][creates]=1;
-			}
-			else if (creates<i)
-			{
-			  connectable[creates][i]=1;
-			}
-		}
-	 }
-  }
-
-
-	if (!encapsulated.empty())//if the list of encapsulated nodes is not empty, start figuring out the regions
-	{
-		enregioning = encapsulated;
-		enregioning.sort();
-		if (to!=from)
-		{
-			//enregioning.merge(findBorders(creates, to, to, encapsulated));//adds the borders to the enregioning list
-		}
-		else
-		{
-			enregioning.push_front(to);
-			enregioning.push_front(creates);
-		}
-		setConnected(encapsulated, enregioning);
-	}
-
-	checkRegion(creates,from,to); //checks to see if the created node is inside a region, and, if so, adjusts the connectable matrix accordingly.
-	gameWinState = checkWin();
-	std::cout<<"Player "<<gameWinState<<" has won.";
-
+//	std::list<int> enregioning;
+//	int enregioned = 0;
+//
+//		for(int i = 0; connectable[i][i]!=-1; i++)//initializes the 'connected' side of the array to zero for the new node?
+//	{
+//		if(i>nextAvailNode)
+//		{
+//			connectable[i][nextAvailNode] = 0;
+//		}
+//		else if (nextAvailNode>i)
+//		{
+//			connectable[nextAvailNode][i] = 0;
+//		}
+//	}
+//
+//	//this section handles the 'connected' side of the array.
+//	if (from>nextAvailNode)  //creating the connection from the 'from' node to the created node
+//	{
+//		connectable[from][nextAvailNode] = 1;
+//	}
+//  else
+//  {
+//		connectable[nextAvailNode][from] = 1;
+//	}
+//	connectable[from][from]+=1;
+//	if (to>nextAvailNode)  //creating the connection from the 'to' node to the created node.
+//	{
+//		connectable[to][nextAvailNode] = 1;
+//	}
+//  else
+//	{
+//		connectable[nextAvailNode][to] = 1;
+//	}
+//	connectable[to][to]+=1;
+//	connectable[nextAvailNode][nextAvailNode]=2;
+//
+//
+//
+//for (int i = 0;connectable[i][i]!=-1;i++) //this handles the initialization of the 'connectable' side of the array
+//  {											//for the created node, taking into consideration the 'near' node.
+//	if(near>i)                              //Note, however, that everything else related to enregioning is performed
+//	{										//At the bottom of the function
+//		if (connectable[i][near])
+//		{
+//			if(nextAvailNode>i)
+//			{
+//			  connectable[i][nextAvailNode]=1;
+//			}
+//			else if (nextAvailNode<i)
+//			{
+//			  connectable[nextAvailNode][i]=1;
+//			}
+//		}
+//	}
+//	if(i>near)
+//	{
+//		if (connectable[i][near])
+//		{
+//			if(i<nextAvailNode)
+//			{
+//			  connectable[i][nextAvailNode]=1;
+//			}
+//			else if (nextAvailNode<i)
+//			{
+//			  connectable[nextAvailNode][i]=1;
+//			}
+//		}
+//	 }
+//  }
+//
+//
+//	if (!encapsulated.empty())//if the list of encapsulated nodes is not empty, start figuring out the regions
+//	{
+//		enregioning = encapsulated;
+//		enregioning.sort();
+//		if (to!=from)
+//		{
+//			//enregioning.merge(findBorders(nextAvailNode, to, to, encapsulated));//adds the borders to the enregioning list
+//		}
+//		else
+//		{
+//			enregioning.push_front(to);
+//			enregioning.push_front(nextAvailNode);
+//		}
+//		setConnected(encapsulated, enregioning);
+//	}
+//
+//	checkRegion(nextAvailNode,from,to); //checks to see if the created node is inside a region, and, if so, adjusts the connectable matrix accordingly.
+//	gameWinState = checkWin();
+//	std::cout<<"Player "<<gameWinState<<" has won.";
+
+// This return value is useless at the moment, but presumably was meant to have to do with whether the move won or not.
 	return 0;
 
 }
+
+/* Source : http://sdl.beuc.net/sdl.wiki/Introduction_to_SDL_Video
+ * Return the pixel value at (x, y)
+ * NOTE: The surface must be locked before calling this!
+ * NOTE 2: SDL_gfx has point drawing functionality - this one is for my experience
+ */
+
+Uint32 getpixel(SDL_Surface *surface, int x, int y)
+{
+    int bpp = surface->format->BytesPerPixel;
+    /* Here p is the address to the pixel we want to retrieve */
+    Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+
+    switch (bpp) {
+    case 1:
+        return *p;
+
+    case 2:
+        return *(Uint16 *)p;
+
+    case 3:
+        if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+            return p[0] << 16 | p[1] << 8 | p[2];
+        else
+            return p[0] | p[1] << 8 | p[2] << 16;
+
+    case 4:
+        return *(Uint32 *)p;
+
+    default:
+        return 0;       /* shouldn't happen, but avoids warnings */
+    } // switch
+}
+#include <iostream>
+#include <cstdlib>
+#include <stdio.h>
+
+#include "SDL.h"
+#include "SDL_gfxPrimitives.h"
+
+#include "include/Sprout.h"
+#include "drawLine.h"
+
+
+extern Uint32 sdl_red;
+extern Uint32 sdl_green;
+extern Uint32 sdl_blue;
+extern Uint32 sdl_black;
+extern Uint32 sdl_white;
+extern Uint32 sdl_yellow;
+extern Uint32 sdl_orange;
+extern Uint32 sdl_gray;
+
+drawLine::drawLine()
+{
+    neighborhood = 5;
+    //firstPlayer = true;
+    beingDragged = false;
+    nodesNeedUpdate = false;
+}
+
+void drawLine::reset(SDL_Surface *theSurf)
+{
+    surface = theSurf;
+
+    // Clear entire screen[][] matrix.
+    for (int i = 0; i < SCREEN_WIDTH; i++)
+    {
+      for (int j = 0; j < SCREEN_HEIGHT; j++)
+      {
+        screen[i][j] = ptCLEAR;
+      }
+    }
+    // But, make a border to keep us from trying to follow trails outside of our legal drawing area.
+    for (int j = 0; j < SCREEN_WIDTH; j++)
+    {
+      screen[j][0] = ptOBSTRUCTED;
+      screen[j][(SCREEN_HEIGHT - 1)] = ptOBSTRUCTED;
+    }
+    for (int k = 0; k < SCREEN_HEIGHT; k++)
+    {
+      screen[0][k] = ptOBSTRUCTED;
+      screen[(SCREEN_HEIGHT - 1)][k] = ptOBSTRUCTED;
+    }
+    //nodesNeedUpdate = true; <-- ###
+    // somewhere in here we want to erase everything
+}
+
+
+void drawLine::finishDrawing(int endX, int endY, Sprout **spots)
+  {
+    // search for an ending node in the neighborhood of endX, endY.
+    endNode = -1;
+    for (int i = -neighborhood; i <= neighborhood; i++)
+    {
+      for (int j = -neighborhood; j <= neighborhood; j++)
+      {
+        if (screen[(endX + i)][(endY + j)] > ptCLEAR) // got one.
+        {
+          endNode = (screen[(endX + i)][(endY + j)] - 1);
+          i = neighborhood + 1; // break out of loop
+          j = neighborhood + 1;
+        }
+      }
+    }
+    x0 = endX;
+    y0 = endY;
+    if (endNode == -1) // we couldn't find a valid end node. Abort drawing
+    {
+      terminateDrawing(endX, endY,spots);
+      return;
+    }
+
+    // If we made it this far, success! We've got a good connection between two nodes.
+    int j = spots[endNode]->node.x;
+    int k = spots[endNode]->node.y;
+    int m = norm1(x0 - j, y0 - k);
+    for (int n = 0; n <= m; n++)
+    {
+      float i1 = ((m - n) * x0 + n * j) / m;
+      float i2 = ((m - n) * y0 + n * k) / m;
+      screen[(int) i1][(int) i2] = ptLARVAL_LINE;
+    }
+    //spots[endNode][2] -= 1; // one fewer connection available at this sprout now.
+//    drawSpot(endNode);
+    // The following for-loops magically finds loops in the path and fixes them
+    for (float i1 = 0; i1 < iTrail; i1 = trail[(int) i1][2])
+    {
+      for (float i2 = iTrail - 1; i2 > i1 + 1; i2--)
+      {
+        if (normInf(trail[(int) i1][0] - trail[(int) i2][0], trail[(int) i1][1] - trail[(int) i2][1]) <= 1)
+        {
+          trail[(int) i1][2] = (int) i2;
+          i1 = i2;
+          i2 = i1;
+        }
+      }
+    }
+
+    distance = 0;
+    transform();
+    screen[j][k] = (endNode + 1);
+
+    // we fill up the area surrounding (tempX,tempY) as follows
+    int tempX = spots[endNode]->node.x;
+    int tempY = spots[endNode]->node.y;
+    if (spots[endNode]->getConnections() >= 3)
+    {
+      markNeighbors(tempX, tempY, ptOBSTRUCTED);
+    }
+    else
+    {
+      markNeighbors(tempX, tempY, ptSPROUT);
+    }
+
+    // repeat for the starting node too
+    tempX = spots[startNode]->node.x;
+    tempY = spots[startNode]->node.y;
+    screen[tempX][tempY] = (startNode + 1);
+    if (spots[startNode]->getConnections() >= 3)
+    {
+      markNeighbors(tempX, tempY, ptOBSTRUCTED);
+    }
+    else
+    {
+      markNeighbors(tempX, tempY, ptSPROUT);
+    }
+
+
+    // now create a new midpoint along the line.
+            // poss. solution here: have calling func. pass us a node pointer, let THEM worry about where it goes afterward
+            // or where it is in the array.
+            //
+    //newSpot(nSpots, bestx, besty);
+    // make a new sprout wherever we can
+    // ###
+    //spots[nSpots][2] = 1;
+    //drawSpot(nSpots);
+    //nSpots += 1;
+
+    drawing = false;
+    ready = false;
+    beginning = false;
+    //setCursor(Cursor.getDefaultCursor());
+  }
+
+  void drawLine::incrementTrail(int curX, int curY,Sprout **spots)
+  {
+    // increase iTrail
+    if (iTrail >= nTrail)
+    {
+      terminateDrawing(curX, curY,spots);
+
+      return;
+    }
+
+    trail[iTrail][0] = curX;
+    trail[iTrail][1] = curY;
+    if (iTrail == 0)
+    {
+      iTrail += 1;
+
+      return;
+    }
+
+    // increment only if this point is *different* from the last one.
+    if ((curX != trail[(iTrail - 1)][0]) || (curY != trail[(iTrail - 1)][1]))
+      iTrail += 1;
+  }
+
+
+void drawLine::terminateDrawing(int curX, int curY, Sprout **spots)
+  {
+    if (drawing)
+    {
+      //bool toSave = true;  // Whether we want to save what was at curX and curY.
+      //int saveVal; // The value itself. If it isn't saved, screen[curX][curY] gets overwritten during markNeighbors()
+
+// man WTF ###
+//      // boundary checks
+//      if(curX < 9)  // 9 because that's what the circle uses down below
+//      {
+//        curX = 9;
+//        toSave = false;
+//      }
+//      else if(curX >= SCREEN_WIDTH)
+//      {
+//        curX = SCREEN_WIDTH-1;
+//        toSave = false;
+//      }
+//      if(curY < 9)
+//      {
+//        curY = 9;
+//        toSave = false;
+//      }
+//      else if (curY >= SCREEN_HEIGHT)
+//      {
+//        curY = SCREEN_HEIGHT - 1;
+//        toSave = false;
+//      }
+//
+//      if(toSave)
+//      {
+//        saveVal = screen[curX][curY];
+//      }
+
+  // if -1 is passed for one of these parameters, just use the last entry in trail
+      if(curX == -1)
+      {
+        curX = trail[iTrail][0];
+      }
+      if(curY==-1)
+      {
+        curY = trail[iTrail][1];
+      }
+
+      drawing = false;
+      ready = false;
+      beginning = false;
+
+      circleColor(surface, curX - 9, curY - 9, 19, sdl_orange); // values may need adjustment here
+      blankIt(sdl_yellow);  // show that the trail drawn so far was invalid
+
+      if (startNode != -1)
+      {
+//        drawSpot(startNode);
+        markNeighbors(spots[startNode]->node.x, spots[startNode]->node.y, ptSPROUT);
+      }
+//      if (toSave)
+//      {
+//        screen[curX][curY] = saveVal;
+//      }
+    }
+    // if we were changing cursors during drawing, we could reset it to normal here.
+  }
+
+
+void drawLine::blankIt()
+  {
+    for (int i = 0; i < iTrail - 1; i++)
+    {
+      int tmpX = trail[i][0];
+      int tmpY = trail[i][1];
+      screen[tmpX][tmpY] = ptCLEAR; // i.e. 0
+    }
+  }
+
+// like the above, but beyond merely clearing the internal screen[][],
+// it draws over the trail in SDL using param color
+ void drawLine::blankIt(Uint32 color)
+  {
+    SDL_Rect drawRect = {0,0,3,3};
+    for (int i = 0; i < iTrail; i++)
+    {
+      int tmpX = trail[i][0];
+      int tmpY = trail[i][1];
+      screen[tmpX][tmpY] = ptCLEAR; // i.e. 0
+      drawRect.x = tmpX;
+      drawRect.y = tmpY;
+      SDL_FillRect(surface, &drawRect, color);
+    }
+  }
+
+// handled by Sprout
+//void drawLine::drawSpot(int paramInt)
+//  {
+//    int i = spots[paramInt][0];
+//    int j = spots[paramInt][1];
+//    int k = spots[paramInt][2];
+//
+//    if (k == 3)
+//    {
+//      //this.g.setColor(Color.blue);
+//      //this.oG.setColor(Color.blue);
+//      theColor = sdl_blue;
+//    }
+//    else if (k == 2)
+//    {
+//      //this.g.setColor(Color.orange);
+//      //this.oG.setColor(Color.orange);
+//      theColor = sdl_orange;
+//    }
+//    else if (k == 1)
+//    {
+//      //this.g.setColor(Color.red);
+//      //this.oG.setColor(Color.red);
+//      theColor = sdl_red;
+//    }
+//    else
+//    {
+//      //this.g.setColor(Color.gray);
+//      //this.oG.setColor(Color.gray);
+//      theColor = sdl_gray;
+//    }
+//    //this.g.fillOval(i - 7, j - 7, 15, 15);
+//    //this.oG.fillOval(i - 7, j - 7, 15, 15);
+//  }
+
+void drawLine::markNeighbors(int nodeX, int nodeY, int newValue)
+  {
+    // this fills up an area in a square around (nodeX, nodeY) with newValue.
+    // it saves what is on that point itself, however.
+    int saveVal = screen[nodeX][nodeY];
+    for (int j = -neighborhood; j <= neighborhood; j++)
+    {
+      for (int k = -neighborhood; k <= neighborhood; k++)
+      {
+        screen[(nodeX + j)][(nodeY + k)] = newValue;
+      }
+    }
+    screen[nodeX][nodeY] = saveVal;
+  }
+
+
+ void drawLine::transform()
+  {
+    SDL_Rect drawRect = {0,0,3,3};
+    int i = 0;
+
+    blankIt();  // clear the trail from screen[][]. Note: without parameters, blankIt()
+                // doesn't do any drawing to the SDL surface.
+
+    // now draw the trail sans loops (self-overlaps).
+    // Also updates screen[][] to be impassable at those same areas.
+    while (i < iTrail)
+    {
+      int j = 100000000;
+      int k = trail[i][0];
+      int m = trail[i][1];
+//      for (int n = 0; n < nSpots; n++)
+//      {
+//        int i1 = norm2(k - spots[n][0], m - spots[n][1]);
+//        if (j > i1)
+//        {
+//          j = i1;
+//        }
+//      }
+//      if (j > distance)
+//      {
+//        distance = j;
+//        bestx = k;
+//        besty = m;
+//      }
+      screen[k][m] = ptOBSTRUCTED;
+      //this.g.fillRect(k - 1, m - 1, 3, 3);
+      //this.oG.fillRect(k, m, 1, 1);
+      drawRect.x = k - 1;
+      drawRect.y = m - 1;
+      SDL_FillRect(surface, &drawRect, sdl_black);
+      i = trail[i][2];
+    }
+  }
+
+  void drawLine::newSpot(int sproutNum, int sproutX, int sproutY)
+  {
+    screen[sproutX][sproutY] = (sproutNum + 1);
+    markNeighbors(sproutX, sproutY, ptSPROUT);
+//    spots[sproutNum][0] = sproutX;
+//    spots[sproutNum][1] = sproutY;
+//    spots[sproutNum][2] = 3;
+//    drawSpot(sproutNum);
+  }
+
+
+void drawLine::connect(int whereX, int whereY, Sprout **spots)
+  {
+    int i = norm1(x0 - whereX, y0 - whereY);
+    int j = i;
+    SDL_Rect drawRect = {0,0,3,3};
+    if (j > 0)
+    {
+      for (int k = 0; k <= j; k++)
+      {
+        int m = ((j - k) * x0 + k * whereX) / j;
+        int n = ((j - k) * y0 + k * whereY) / j;
+        incrementTrail(m, n,spots);
+        if (screen[m][n] != ptLARVAL_LINE)
+        {
+          if (screen[m][n] == ptCLEAR)
+          {
+            beginning = false;
+            if (!done)
+            {
+              if(startNode > 0)
+              {
+
+              int i1 = spots[startNode]->node.x;
+              int i2 = spots[startNode]->node.y;
+              if (spots[startNode]->getConnections() >= 3)
+              {
+                markNeighbors(i1, i2, ptOBSTRUCTED);
+              }
+              else
+              {
+                markNeighbors(i1, i2, ptSPROUT);
+              }}
+              else
+                std::cout << "Problem! " << startNode << std::endl;
+              done = true;
+            }
+          }
+          if ((screen[m][n] == ptCLEAR) || ((screen[m][n] == ptSPROUT) && (beginning)))
+          {
+            screen[m][n] = ptLARVAL_LINE;
+            drawRect.x = m - 1;
+            drawRect.y = n - 1;
+            SDL_FillRect(surface, &drawRect, sdl_yellow);
+            //fillRect(m - 1, n - 1, 3, 3);
+
+          }
+          else if ((screen[m][n] == ptSPROUT) && (!beginning))
+          {
+            incrementTrail(whereX, whereY,spots);
+            screen[whereX][whereY] = ptLARVAL_LINE;
+            finishDrawing(m, n,spots);
+            k = j;
+          }
+          else if (screen[m][n] == ptOBSTRUCTED)
+          {
+            terminateDrawing(m, n, spots);
+            k = j;
+          }
+        }
+      }
+      x0 = whereX;
+      y0 = whereY;
+    }
+  }
+
+void drawLine::mousePressed(int x, int y, Sprout **spots)
+{
+    if (!beingDragged)
+    {
+      //repaint();
+//      if (ready)
+//      {
+        beginning = true;
+        done = false;
+        drawing = true;
+        beingDragged = true;
+        iTrail = 0;
+        int i = x; // probably not necessary to have i and j here instead of just using the arguments, x and y
+        int j = y;
+        startNode = -1;
+        for (int k = -neighborhood; k <= neighborhood; k++)
+        {
+          for (int m = -neighborhood; m <= neighborhood; m++)
+          {
+            if (screen[(i + k)][(j + m)] > 0)
+            {
+              startNode = (screen[(i + k)][(j + m)] - 1);
+              k = neighborhood + 1;  // break out of for loops
+              m = neighborhood + 1;
+            }
+          }
+        }
+        if (startNode != -1)
+        {
+          x0 = spots[startNode]->node.x;
+          y0 = spots[startNode]->node.y;
+
+          connect(i, j,spots);
+
+          //spots[startNode][2] -= 1; // spots[][2] is number of available connections
+//          drawSpot(startNode);
+//          if (firstPlayer)
+//          {
+//            //g.setColor(Color.green);
+//            theColor = sdl_green;
+//          }
+//          else
+//          {
+//            //g.setColor(Color.red);
+//            theColor = sdl_red;
+//          }
+        }
+        iTrail = 0;
+        for (int m = 0; m < nTrail; m++)
+          trail[m][2] = (m + 1);
+      //} // if ready
+    } // if not being dragged
+
+}
+
+
+bool drawLine::isDraggingNow()
+{
+    return beingDragged;
+}
+
+int drawLine::norm1(int paramInt1, int paramInt2)
+  {
+    int i = paramInt1;
+    if (i < 0)
+    {
+      i = -paramInt1;
+    }
+    int j = paramInt2;
+    if (j < 0)
+    {
+      j = -paramInt2;
+    }
+    return i + j;
+  }
+
+int drawLine::norm2(int paramInt1, int paramInt2)
+  {
+    return paramInt1 * paramInt1 + paramInt2 * paramInt2;
+  }
+
+int drawLine::normInf(int paramInt1, int paramInt2)
+  {
+    int i = paramInt1;
+    if (i < 0)
+    {
+      i = -paramInt1;
+    }
+    int j = paramInt2;
+    if (j < 0)
+    {
+      j = -paramInt2;
+    }
+    if (i > j) { return i; }
+
+    return j;
+  }
+
+#ifndef _DRAWLINE_H
+#define _DRAWLINE_H
+
+#include "SDL.h"
+#include "include/draw.h"
+
+const int nTrail = SCREEN_WIDTH * 5; // The longest trail that we'll keep track of. (5 screen widths.)
+
+class drawLine
+{
+    public:
+        // these are used in screen[][] below.
+        static const int ptOBSTRUCTED = -3;   // impassable point. line, screen edge, or full sprout.
+        static const int ptSPROUT = -1;       // a sprout is here, but it's available for new connections.
+        static const int ptCLEAR = 0;         // empty.
+        static const int ptLARVAL_LINE = -2;  // marks a line that's being drawn but has not been finalized yet.
+
+        int screen[SCREEN_WIDTH + 100][SCREEN_HEIGHT + 100];// This keeps track of node positions and what areas are currently drawable.
+                                                            // Might be more efficient to merge this with something in Game in the future.
+
+        int trail[nTrail][3]; // The current trail that we're drawing. First column [][0] is x, second column [][1]
+                              // is y, third column [][2] is used when removing loops (self-overlaps) from a trail.
+
+        //int spots[10000][3];//This needs to be replaced by our new Sprouts stuff.
+        int nodes; // Number of sprouts made <-- TBD ###
+        int iTrail; // Where we currently are in the trail. Indexes first dimension of trail[][].
+        int distance; // Total distance travelled so far. (?)###
+        int neighborhood; // How many "pixels" around a point in screen[][] to fill or check.  default is 5.
+                          // used in markNeighborhood() and finishDrawing().
+                          // Goes from -neighborhood to neighborhood, so remember total width and height will each be (2 * neighborhood)
+
+        int x0, y0;
+        int startNode; // Index for node we start at. Indexes Game->nodes[].
+        int endNode;   // Ditto for where we end.
+        int bestx, besty; // Where a new node, the midpoint between startNode and endNode, will be placed.
+
+        bool beingDragged;
+        bool beginning;
+        bool drawing; // ### drawing may be redundant, beingDragged covers that job
+        bool ready;
+        bool done;
+        bool nodesNeedUpdate; // a flag to let the user class know that it should redraw the nodes.
+        //Uint32 theColor;
+        SDL_Surface *surface; // Surface for all our drawing. Make sure this gets allocated correctly.
+
+        drawLine();
+        void reset(SDL_Surface *theSurf);
+        void finishDrawing(int wherex, int wherey, Sprout **spots); // halt drawing, presumably with a successfully "charted" trail.
+        void terminateDrawing(int wherex, int wherey, Sprout **spots); // halt drawing, but without a successful trail.
+        void incrementTrail(int, int, Sprout **spots); // Increase iTrail
+        void blankIt(); // clears trail from screen matrix, but does not draw to the the SDL surface
+        void blankIt(Uint32 color); // paints over the entire trail with color. Used for erasing and showing invalid trails.
+        //void drawSpot(int);
+        void markNeighbors(int nodeX, int nodeY, int newValue); // fill newValue in a rectangle in screen[][], centered around nodeX, nodeY.
+        void transform();             // draws the modified trail in black after loops/self-collisions have been removed. also updates screen[][]
+        void newSpot(int, int, int); // ### TBD
+        void connect(int x, int y, Sprout **spots); // draw part of the "working" trail ("larval line"). call when following mouse
+        void mousePressed(int x, int y, Sprout **spots);  // handle mouse down at x, y
+        bool isDraggingNow(); // returns state of beingDragged ###
+
+        // some norm-calculating utility functions
+        int norm1(int a, int b);    // abs(a) + abs(b)
+        int norm2(int a, int b);    // (a * a) + (b * b)
+        int normInf(int a, int b);  // greater of abs(a) and abs(b)
+
+
+};
+
+
+#endif

images/loadingscreen/front.png

Old
Old image
New
New image

images/loadingscreen/front01.png

Added
New image
 // Header for global drawing functions
 
 //Screen attributes
-const int SCREEN_WIDTH = 800;
-const int SCREEN_HEIGHT = 600;
+#define SCREEN_WIDTH 800
+#define SCREEN_HEIGHT 600
 const int SCREEN_BPP = 32;
 
 struct Point
 #pragma once
 
 #include <list>
-#include "Sprout.h"
+#include "Sprout.h"
 
 class Bezier; //Prototype Bezier so we can use it here.
 class Sprout; //Prototype Node.
 class TextBox;
-struct SproutClips;  // Prototype struct
+struct SproutClips;  // Prototype struct
 
 class Game{
   private:
 	  int gameWinState;
 	  int nodeNumbers;
   public:
-    int count; //Number of initial nodes in the game.
-    Bezier ***connection; //2D array of pointers to Beziers.
+    int count; //Number of initial nodes in the game.
+    int nextAvailNode; // the next available node. It is set to -1 when no node slots have been sought out or found.
+    Bezier ***connection; //2D array of pointers to Beziers.
+    //drawLine lines; // ideally, this should replace the Bezier class in a little while.
     Sprout **nodes; //Array of Node pointers.
-    TextBox * text;
+    TextBox * text;
+
     Game(bool, bool, int, SproutClips *); //Main constructor, makes a game with turn, mesier, and number of initial nodes.
     Game(Game *); //Constructor for copying games.
 		int freeConnections(int); //Returns the number of connections a node has available to it.
     bool notEnregioned(int node, std::list<int> encapsulated);
 
     std::list<int> findBorders(int from, int to, int prev,std::list<int>);
-    bool applyMove(int from, int to, int creates, std::list<int> encapsulated, bool clockwise, int near);
+    //bool applyMove(int from, int to, int creates, std::list<int> encapsulated, bool clockwise, int near);
+    bool applyMove(int from, int to, int newX, int newY);
     void output_console(void);
     void output_file(FILE *, char *);
     void move(char *);
+#include <vector>
+#include "draw.h"
+#include "bezierDraw.h"
+