SHARE
TWEET

3D Walk input part

g-stoyanov Feb 1st, 2013 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string[] inputXYZ = Console.ReadLine().Split(new char[] { ' ' });
  2.             int valX = int.Parse(inputXYZ[0]);
  3.             int valY = int.Parse(inputXYZ[1]);
  4.             int valZ = int.Parse(inputXYZ[2]);
  5.             int[, ,] cube = new int[valZ, valY, valX];
  6.             StringBuilder sbInput = new StringBuilder();
  7.             for (int i = 0; i < valY; i++)
  8.             {
  9.                 sbInput.Append(string.Format("{0} ", Console.ReadLine()));
  10.             }
  11.  
  12.             sbInput.Replace(" | ", " ");
  13.             string[] tempArr = sbInput.ToString().Split(new char[]{' '});
  14.             int tempIndex = 0;
  15.             for (int tempY = 0; tempY < valY; tempY++)
  16.             {
  17.                 for (int tempZ = 0; tempZ < valZ; tempZ++)
  18.                 {
  19.                     for (int tempX = 0; tempX < valX; tempX++)
  20.                     {
  21.                         cube[tempZ, tempY, tempX] = int.Parse(tempArr[tempIndex]);
  22.                         tempIndex++;
  23.                     }
  24.                 }
  25.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top