//On FormLoad generate randomlly the mines onto the playBoard public void Generate(sbyte mines, sbyte rows, sbyte cols) { sbyte[,] matrix = new sbyte[rows, cols]; Random generateBomb = new Random(); //Iterate through the Play Board until all mines are positioned(when mines = 0) while (mines > 0) { for (int row = 1; row < matrix.GetLength(0) - 1; row++) { for (int col = 1; col < matrix.GetLength(1) - 1; col++) { //If the current cell has a mine skip it if (matrix[row, col] != 1 && generateBomb.Next(0, 6) == 1) { matrix[row, col] = 1; mines--; if (mines == 0) { break; } } } if (mines == 0) { break; } } } playBoardMatrix = matrix; }
static void Main(string[] args) { byte N = byte.Parse(Console.ReadLine()); sbyte[,] myArray = new sbyte[N, N]; for (int j = 0; j < myArray.GetLength(0); j++) { for (int i = myArray.GetLength(1) - 1; i > j; i--) { myArray[j, i] = 1; } for (int i = 0; i < j; i++) { myArray[j, i] = -1; } } for (int i = 0; i < myArray.GetLength(0); i++) { for (int j = 0; j < myArray.GetLength(1); j++) { Console.Write($"\t{myArray[i, j]}"); } Console.WriteLine(); } }
static void Main(string[] args) { if (!byte.TryParse(Console.ReadLine(), out byte N)) { Console.WriteLine("Incorrect input"); return; } sbyte[,] myArray = new sbyte[N, N]; for (int j = 0; j < myArray.GetLength(0); j++) { for (int i = myArray.GetLength(1) - 1; i > j; i--) { myArray[j, i] = 1; } for (int i = 0; i < j; i++) { myArray[j, i] = -1; } } for (int i = 0; i < myArray.GetLength(0); i++) { for (int j = 0; j < myArray.GetLength(1); j++) { Console.Write($"\t{myArray[i, j]}"); } Console.WriteLine(); } }
public void StartAnalysis() { try { if (game != null && !overwriteGameData) { gOBtnStart.SetActive(false); gOBtnPause.SetActive(true); createGamePanel.SetActive(false); mainTable.GetComponent <CanvasGroup>().blocksRaycasts = false; frequences.alpha = 1; graphicalMethod.alpha = 1; btnGameSelect.interactable = false; executive = game.Executive(); StartCoroutine(executive); } else if (overwriteGameData) { sbyte[,] matrix = new sbyte[GameTheory.Game.gameData.rowStrategies.Count, GameTheory.Game.gameData.columnStrategies.Count]; byte id = 0; for (byte i = 0; i < matrix.GetLength(0); i++) { for (byte j = 0; j < matrix.GetLength(1); j++) { string value = TableManager.ins.mainTable.GetChild(id).GetComponent <InputField>().text; if (string.IsNullOrEmpty(value)) { throw new FormatException("Pusta wartość w tabeli wypłat"); } else { matrix[i, j] = sbyte.Parse(value); id++; } } } GameData gD = new GameData(GameTheory.Game.gameData, matrix); game = new GameTheory.Game(gD); overwriteGameData = false; StartAnalysis(); } else { LogsManager.ins.AddLog("Nie można rozpocząc pustej gry", EColors.Red); } } catch (Exception e) { LogsManager.ins.AddLog(e.Message, EColors.Red); } }
//compression public Bitmap convertIntraFrame(Bitmap bit) { intraFrame = new Bitmap(bit.Width, bit.Height); width = intraFrame.Width; height = intraFrame.Height; Y = new byte[width, height]; Cb = new byte[width, height]; Cr = new byte[width, height]; RGBtoYCbCr(bit, Y, Cb, Cr); subSampling(ref Cb, ref Cr); YDCT = new double[width, height]; CbDCT = new double[Cb.GetLength(0), Cb.GetLength(1)]; CrDCT = new double[Cr.GetLength(0), Cr.GetLength(1)]; YQuant = new sbyte[width, height]; CbQuant = new sbyte[Cb.GetLength(0), Cb.GetLength(1)]; CrQuant = new sbyte[Cr.GetLength(0), Cr.GetLength(1)]; YEncode = new List <byte>(); CbEncode = new List <byte>(); CrEncode = new List <byte>(); YDCT = DCT(Y); CbDCT = DCT(Cb); CrDCT = DCT(Cr); YQuant = quantization(YDCT); CbQuant = quantization(CbDCT); CrQuant = quantization(CrDCT); YEncode = encoding(YQuant); CbEncode = encoding(CbQuant); CrEncode = encoding(CrQuant); YQuant = decoding(YEncode, YQuant.GetLength(0), YQuant.GetLength(1)); CbQuant = decoding(CbEncode, CbQuant.GetLength(0), CbQuant.GetLength(1)); CrQuant = decoding(CrEncode, CrQuant.GetLength(0), CrQuant.GetLength(1)); YDCT = invQuantization(YQuant); CbDCT = invQuantization(CbQuant); CrDCT = invQuantization(CrQuant); Y = inverseDCT(YDCT, width, height); Cb = inverseDCT(CbDCT, Cb.GetLength(0), Cb.GetLength(1)); Cr = inverseDCT(CrDCT, Cr.GetLength(0), Cr.GetLength(1)); unsubSampling(ref Cb, ref Cr); YCbCrtoRGB(intraFrame, Y, Cb, Cr); return(intraFrame); }
/// <summary> /// Funckja zwraca maciarz wypłat z pliku /// </summary> /// <param name="fileName">Nazwa pliku</param> /// <returns>Macierz wypłat</returns> private sbyte[,] GetMatrixFromFile(string fileName) { string path = string.Format(@"{0}\Games", Application.dataPath); sbyte[,] loadedMatrix; using (StreamReader sR = new StreamReader(string.Format(@"{0}\{1}", path, fileName))) { string line = sR.ReadLine(); // Pierwsza linia określna liczbę kolumn i wierszy macierzy. string[] sub = line.Split(' '); loadedMatrix = new sbyte[byte.Parse(sub[0]), byte.Parse(sub[1])]; byte row = 0; while ((line = sR.ReadLine()) != null) { sub = line.Split(' '); for (int column = 0; column < loadedMatrix.GetLength(1); column++) { loadedMatrix[row, column] = sbyte.Parse(sub[column]); } row++; } if (sR != null) { sR.Close(); } } return(loadedMatrix); }
/// <summary> /// /// </summary> /// <param name="k">Should be greater than zero</param> /// <returns></returns> public static sbyte[,] GetMatrix(int k) { var prevMatrix = new sbyte[, ] { { 1 } }; var order = 0; while (order < k) { ++order; var prevLength = prevMatrix.GetLength(0); var nextMatrix = new sbyte[2 * prevLength, 2 * prevLength]; for (int i = 0; i < prevLength; i++) { for (int j = 0; j < prevLength; j++) { nextMatrix[2 * i, j] = nextMatrix[2 * i + 1, j] = nextMatrix[2 * i, prevLength + j] = prevMatrix[i, j]; nextMatrix[2 * i + 1, prevLength + j] = (sbyte)-prevMatrix[i, j]; } } prevMatrix = nextMatrix; if (order >= k) { break; } } return(prevMatrix); }
private VHGT CreateHeightMapSubrecord(int offsetX, int offsetY, float[,] importedHeightMap) { var heightDeltas = new sbyte[HEIGHT_CELL_SIZE, HEIGHT_CELL_SIZE]; float grad = 0; for (int y = heightDeltas.GetLength(0) - 1; y >= 0; y--) { for (int x = heightDeltas.GetLength(1) - 1; x >= 0; x--) { var y2 = offsetY + y; var x2 = offsetX + x; if (x == 0) { if (y == 0) { heightDeltas[y, x] = 0; return(new VHGT { HeightDelta = heightDeltas, HeightOffset = importedHeightMap[y2, x2], }); } grad = (importedHeightMap[y2, x2] - importedHeightMap[y2 - 1, x2]); grad = grad > 127 ? 127 : grad; grad = grad < -128 ? -128 : grad; heightDeltas[y, x] = (sbyte)grad; continue; } grad = (importedHeightMap[y2, x2] - importedHeightMap[y2, x2 - 1]); grad = grad > 127 ? 127 : grad; grad = grad < -128 ? -128 : grad; heightDeltas[y, x] = (sbyte)grad; } } return(null); }
private sbyte[,] decoding(List <byte> list, int width, int height) { sbyte[,] tmp = new sbyte[width, height]; int currentIndex = 0; for (int i = 0; i < tmp.GetLength(1); i += BLOCK_HEIGHT) { for (int j = 0; j < tmp.GetLength(0); j += BLOCK_WIDTH) { for (int k = 0; k < patternList.GetLength(0);) { if (list.ElementAt(currentIndex) == 0) { currentIndex++; byte count = list.ElementAt(currentIndex); currentIndex++; sbyte value = (sbyte)list.ElementAt(currentIndex); for (int m = 0; m < count; m++) { tmp[patternList[k, 0] + j, i + patternList[k, 1]] = value; k++; } } else { sbyte value = (sbyte)list.ElementAt(currentIndex); tmp[patternList[k, 0] + j, i + patternList[k, 1]] = value; k++; } currentIndex++; } } } return(tmp); }
protected Directions FindNextDirection(Vector2 startPosition, Directions direction, Modes mode) { var targetedTile = new Vector2(); var nextPosition = new Vector2(); var directions = new sbyte[4, 2] { { 0, -1 }, { -1, 0 }, { 0, 1 }, { 1, 0 } }; var allowedDirections = new List <Directions> { }; var newDirection = new Directions(); double lowestEuclidean = -1; // Set the new targeted tile according to the current mode. switch (mode) { case (Modes.Chase): targetedTile = targetTile; break; case (Modes.Scatter): targetedTile = scatterTile; break; case (Modes.Frightened): break; case (Modes.Respawning): targetedTile = respawnTile; break; } // Set the new square to move to. switch (currentDirection) { case (Directions.Up): if (isFirstMove) { nextPosition = new Vector2(startPosition.x, startPosition.y + 0.5f); } else { nextPosition = new Vector2(startPosition.x, startPosition.y + 1f); } break; case (Directions.Left): if (isFirstMove) { nextPosition = new Vector2(startPosition.x - 0.5f, startPosition.y); } else { nextPosition = new Vector2(startPosition.x - 1f, startPosition.y); } break; case (Directions.Down): if (isFirstMove) { nextPosition = new Vector2(startPosition.x, startPosition.y - 0.5f); } else { nextPosition = new Vector2(startPosition.x, startPosition.y - 1f); } break; case (Directions.Right): if (isFirstMove) { nextPosition = new Vector2(startPosition.x + 0.5f, startPosition.y); } else { nextPosition = new Vector2(startPosition.x + 1f, startPosition.y); } break; } // Special check for warp zones if ((tile.x <= 0 && currentDirection == Directions.Left) || (tile.x >= gameController.pacTiles.GetLength(0) - 2 && currentDirection == Directions.Right) || (tile.y <= 0 && currentDirection == Directions.Up) || (tile.y >= gameController.pacTiles.GetLength(1) - 2 && currentDirection == Directions.Down)) { isWarping = true; return(currentDirection); } // If the ghost is out of the map, continue on the same direction if (tile.x < 0 || tile.x >= gameController.pacTiles.GetLength(0) || tile.y < 0 || tile.y >= gameController.pacTiles.GetLength(1)) { return(currentDirection); } // Check if the endPosition Tile is an intersection. if (gameController.GetPacTile((int)nextPosition.x, (int)Math.Abs(nextPosition.y)).allowedDirections.Count > 0) { // If the ghost is currently Frightened, // remove the inverted direction and randomize. if (mode == Modes.Frightened) { var tempAllowedDirections = new List <Directions> { }; Directions invertedDirection = Directions.Up; Directions frightDirection = Directions.Up; tempAllowedDirections = gameController.GetPacTile((int)nextPosition.x, (int)Math.Abs(nextPosition.y)).allowedDirections; switch (direction) { case (Directions.Up): invertedDirection = Directions.Down; break; case (Directions.Left): invertedDirection = Directions.Right; break; case (Directions.Down): invertedDirection = Directions.Up; break; case (Directions.Right): invertedDirection = Directions.Left; break; } frightDirection = invertedDirection; while (frightDirection == invertedDirection) { frightDirection = tempAllowedDirections[UnityEngine.Random.Range(0, tempAllowedDirections.Count)]; } return(frightDirection); } allowedDirections = gameController.GetPacTile((int)nextPosition.x, (int)Math.Abs(nextPosition.y)).allowedDirections; // Check the lowest Euclidean on all allowed Directions // We start from the end so that the priority becomes Up, Left, Down, Right for (int i = allowedDirections.Count - 1; i >= 0; i--) { var tempPosition = new Vector2(); switch (allowedDirections[i]) { case (Directions.Up): // If the current direction is Up, it can't go Down. if (currentDirection != Directions.Down) { tempPosition = new Vector2(nextPosition.x, nextPosition.y + 1); if (Euclidean(tempPosition, targetedTile) <= lowestEuclidean || lowestEuclidean == -1) { lowestEuclidean = Euclidean(tempPosition, targetedTile); newDirection = Directions.Up; } } break; case (Directions.Left): // If the current direction is Right, it can't go Left. if (currentDirection != Directions.Right) { tempPosition = new Vector2(nextPosition.x - 1, nextPosition.y); if (Euclidean(tempPosition, targetedTile) <= lowestEuclidean || lowestEuclidean == -1) { lowestEuclidean = Euclidean(tempPosition, targetedTile); newDirection = Directions.Left; } } break; case (Directions.Down): // If the current direction is Up, it can't go Down. if (currentDirection != Directions.Up) { tempPosition = new Vector2(nextPosition.x, nextPosition.y - 1); if (Euclidean(tempPosition, targetedTile) <= lowestEuclidean || lowestEuclidean == -1) { lowestEuclidean = Euclidean(tempPosition, targetedTile); newDirection = Directions.Down; } } break; case (Directions.Right): // If the current direction is Left, it can't go Right. if (currentDirection != Directions.Left) { tempPosition = new Vector2(nextPosition.x + 1, nextPosition.y); if (Euclidean(tempPosition, targetedTile) <= lowestEuclidean || lowestEuclidean == -1) { lowestEuclidean = Euclidean(tempPosition, targetedTile); newDirection = Directions.Right; } } break; } /*if (DebugPath) * { * print(lowestEuclidean + " | " + tempPosition + " | " + allowedDirections[i] + " | " + Euclidean(tempPosition, targetedTile)); * print("Direction Chosen: " + nextDirection + " INDEX: " + i + " COUNT: " + (allowedDirections.Count - 1)); * }*/ } } else { // If not, follow the only possible path (Without going backwards). for (int i = 0; i < directions.GetLength(0); i++) { var tempPosition = new Vector2(nextPosition.x + directions[i, 0], nextPosition.y + directions[i, 1]); PacTile tempTile = gameController.GetPacTile((int)tempPosition.x, (int)(-1 * tempPosition.y)); switch (VectorToDirection(nextPosition, tempPosition)) { case (Directions.Up): if (tempTile.cost != 0 && currentDirection != Directions.Down) { newDirection = Directions.Up; } break; case (Directions.Left): if (tempTile.cost != 0 && currentDirection != Directions.Right) { newDirection = Directions.Left; } break; case (Directions.Down): if (tempTile.cost != 0 && tempTile.cost != 2 && currentDirection != Directions.Up) { newDirection = Directions.Down; } break; case (Directions.Right): if (tempTile.cost != 0 && currentDirection != Directions.Left) { newDirection = Directions.Right; } break; } } } return(newDirection); }
public Bitmap SobelFilter(Bitmap sourceImage, int greyScale) { int b, g, r, r_x, g_x, b_x, r_y, g_y, b_y, grayscale, location, location2; sbyte[,] weights_x = new sbyte[, ] { { 1, 0, -1 }, { 2, 0, -2 }, { 1, 0, -1 } }; sbyte[,] weights_y = new sbyte[, ] { { 1, 2, 1 }, { 0, 0, 0 }, { -1, -2, -1 } }; Bitmap resultImage = new Bitmap(sourceImage.Width, sourceImage.Height); BitmapData srcData = sourceImage.LockBits(new Rectangle(0, 0, sourceImage.Width, sourceImage.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); BitmapData resultData = resultImage.LockBits(new Rectangle(0, 0, sourceImage.Width, sourceImage.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); byte[] pixelBuffer = new byte[srcData.Stride * sourceImage.Height]; byte[] resultBuffer = new byte[srcData.Stride * sourceImage.Height]; IntPtr pointer = srcData.Scan0; IntPtr pointer2 = resultData.Scan0; Marshal.Copy(pointer, pixelBuffer, 0, pixelBuffer.Length); for (int y = 0; y < sourceImage.Height; y++) { for (int x = 0; x < sourceImage.Width * 3; x += 3) { //reset the gradients in x-direcion values r_x = g_x = b_x = 0; //reset the gradients in y-direction values r_y = g_y = b_y = 0; //to get the location of any pixel >> location = x + y * Stride location = x + y * srcData.Stride; for (int yy = -(int)Math.Floor(weights_y.GetLength(0) / 2.0d), yyy = 0; yy <= (int)Math.Floor(weights_y.GetLength(0) / 2.0d); yy++, yyy++) { //to prevent crossing the bounds of the array if (y + yy >= 0 && y + yy < sourceImage.Height) { for (int xx = -(int)Math.Floor(weights_x.GetLength(1) / 2.0d) * 3, xxx = 0; xx <= (int)Math.Floor(weights_x.GetLength(1) / 2.0d) * 3; xx += 3, xxx++) { //to prevent crossing the bounds of the array if (x + xx >= 0 && x + xx <= sourceImage.Width * 3 - 3) { //to get the location of any pixel >> location = x + y * Stride location2 = x + xx + (yy + y) * srcData.Stride; sbyte weight_x = weights_x[yyy, xxx]; sbyte weight_y = weights_y[yyy, xxx]; //applying the same weight to all channels b_x += pixelBuffer[location2] * weight_x; g_x += pixelBuffer[location2 + 1] * weight_x; r_x += pixelBuffer[location2 + 2] * weight_x; b_y += pixelBuffer[location2] * weight_y; g_y += pixelBuffer[location2 + 1] * weight_y; r_y += pixelBuffer[location2 + 2] * weight_y; } } } } //getting the magnitude for each channel b = (int)Math.Sqrt(Math.Pow(b_x, 2) + Math.Pow(b_y, 2)); g = (int)Math.Sqrt(Math.Pow(g_x, 2) + Math.Pow(g_y, 2)); r = (int)Math.Sqrt(Math.Pow(r_x, 2) + Math.Pow(r_y, 2)); if (b > 255) { b = 255; } if (g > 255) { g = 255; } if (r > 255) { r = 255; } //getting grayscale value grayscale = (b + g + r) / 3; //thresholding to clean up the background if (grayscale < greyScale) { grayscale = 0; } resultBuffer[location] = (byte)grayscale; resultBuffer[location + 1] = (byte)grayscale; resultBuffer[location + 2] = (byte)grayscale; //thresholding to clean up the background - add colors to page if we need //if (b < 100) b = 0; //if (g < 100) g = 0; //if (r < 100) r = 0; } } Marshal.Copy(resultBuffer, 0, pointer2, pixelBuffer.Length); sourceImage.UnlockBits(srcData); resultImage.UnlockBits(resultData); return(RemoveWhiteBorderFromImage(resultImage)); }
public Bitmap convertInterFrame(Bitmap bit) { interFrame = new Bitmap(bit.Width, bit.Height); width = intraFrame.Width; height = intraFrame.Height; YInter = new byte[width, height]; CbInter = new byte[width, height]; CrInter = new byte[width, height]; RGBtoYCbCr(bit, YInter, CbInter, CrInter); subSampling(ref CbInter, ref CrInter); subSampling(ref Cb, ref Cr); YDif = calcDifference(Y, YInter, out YMoVec); CbDif = calcDifference(Cb, CbInter, out CbMoVec); CrDif = calcDifference(Cr, CrInter, out CrMoVec); YDCTInter = new double[width, height]; CbDCTInter = new double[CbInter.GetLength(0), CbInter.GetLength(1)]; CrDCTInter = new double[CrInter.GetLength(0), CrInter.GetLength(1)]; YQuantInter = new sbyte[width, height]; CbQuantInter = new sbyte[CbInter.GetLength(0), CbInter.GetLength(1)]; CrQuantInter = new sbyte[CrInter.GetLength(0), CrInter.GetLength(1)]; YEncodeInter = new List <byte>(); CbEncodeInter = new List <byte>(); CrEncodeInter = new List <byte>(); YDCTInter = DCT(YDif); CbDCTInter = DCT(CbDif); CrDCTInter = DCT(CrDif); YQuantInter = quantization(YDCTInter); CbQuantInter = quantization(CbDCTInter); CrQuantInter = quantization(CrDCTInter); YEncodeInter = encoding(YQuantInter); CbEncodeInter = encoding(CbQuantInter); CrEncodeInter = encoding(CrQuantInter); YQuantInter = decoding(YEncodeInter, YQuantInter.GetLength(0), YQuantInter.GetLength(1)); CbQuantInter = decoding(CbEncodeInter, CbQuantInter.GetLength(0), CbQuantInter.GetLength(1)); CrQuantInter = decoding(CrEncodeInter, CrQuantInter.GetLength(0), CrQuantInter.GetLength(1)); YDCTInter = invQuantization(YQuantInter); CbDCTInter = invQuantization(CbQuantInter); CrDCTInter = invQuantization(CrQuantInter); YDif = inverseDCTInter(YDCTInter, width, height); CbDif = inverseDCTInter(CbDCTInter, CbInter.GetLength(0), CbInter.GetLength(1)); CrDif = inverseDCTInter(CrDCTInter, CrInter.GetLength(0), CrInter.GetLength(1)); YInter = unCalcDifference(Y, YMoVec, YDif); CbInter = unCalcDifference(Cb, CbMoVec, CbDif); CrInter = unCalcDifference(Cr, CrMoVec, CrDif); unsubSampling(ref CbInter, ref CrInter); YCbCrtoRGB(interFrame, YInter, CbInter, CrInter); return(interFrame); }
public void CreaTablero() { Tablero = new sbyte[Tablero.GetLength(0), Tablero.GetLength(1)]; Console.CursorVisible = true; Console.CursorSize = 50; sbyte inicioX = (sbyte)(DesplazamientoX + MARGENBORDE); sbyte finX = (sbyte)(Tablero.GetLength(1) + DesplazamientoX); sbyte inicioY = (sbyte)(DesplazamientoY + MARGENBORDE); sbyte finY = (sbyte)(Tablero.GetLength(0) + DesplazamientoY); sbyte posActualX = inicioX; sbyte posActualY = inicioY; ConsoleKeyInfo tecla; DibujaMarco(); Console.SetCursorPosition(inicioX, inicioY); do { tecla = Console.ReadKey(true); switch (tecla.Key) { case ConsoleKey.UpArrow: if (posActualY != inicioY) { posActualY--; } break; case ConsoleKey.DownArrow: if (posActualY != finY) { posActualY++; } break; case ConsoleKey.LeftArrow: if (posActualX != inicioX) { posActualX--; } break; case ConsoleKey.RightArrow: if (posActualX != finX) { posActualX++; } break; case ConsoleKey.Enter: Console.Write("x={0},y={1}", posActualX - DesplazamientoX - 1, posActualY - DesplazamientoY - 1); Console.ReadKey(); Actualiza(posActualX, posActualY, true); break; case ConsoleKey.D1: case ConsoleKey.NumPad1: Tablero[posActualY - DesplazamientoY - MARGENBORDE, posActualX - DesplazamientoX - MARGENBORDE] = 1; Console.Write('*'); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: CopiarFigura(spin_hor, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D3: case ConsoleKey.NumPad3: CopiarFigura(spin_ver, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D4: case ConsoleKey.NumPad4: CopiarFigura(barco, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D5: case ConsoleKey.NumPad5: CopiarFigura(sapo, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D6: case ConsoleKey.NumPad6: CopiarFigura(planeador, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D7: case ConsoleKey.NumPad7: CopiarFigura(nave, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D8: case ConsoleKey.NumPad8: CopiarFigura(diehard, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D9: case ConsoleKey.NumPad9: CopiarFigura(acorn, (sbyte)(posActualY - DesplazamientoY - MARGENBORDE), (sbyte)(posActualX - DesplazamientoX - MARGENBORDE)); Actualiza(posActualX, posActualY, false); break; case ConsoleKey.D0: case ConsoleKey.NumPad0: Tablero[posActualY - DesplazamientoY - MARGENBORDE, posActualX - DesplazamientoX - MARGENBORDE] = 0; Console.Write(' '); Actualiza(posActualX, posActualY, false); break; } Console.SetCursorPosition(posActualX, posActualY); } while (tecla.Key != ConsoleKey.Escape); do { SiguienteIteracion(); Thread.Sleep(200); } while (!Console.KeyAvailable); }