static List<int> visitados = new List<int>(); //lista de preguntas realizadas #endregion Fields #region Methods /* *Efecto: carga los datos de la matriz de características y el vector de especies. *Requiere: la inicialización de la clase. *Modifica: el vector de especie y la matriz de características. */ public void cargarMatriz() { especie = new String[27] { "Clarisia biflora", "Dorstenia choconiana", "Ficus americana", "Ficus aurea", "Ficus brevibracteata ", "Ficus cervantesiana ", "Ficus citrifolia ", "Ficus colubrinae ", "Ficus costaricana ", "Ficus crassiuscula ", "Ficus crocata ", "Ficus hartwegii", "Ficus macbridei", "Ficus obtusifolia", " Ficus paraensis ", "Ficus pertusa ", "Ficus tonduzii ", "Ficus velutina ", "Ficus yoponensis ", "Maquira guianensis ", "Naucleopsis capirensis", " Pseudolmedia glabrata", "Pseudolmedia mollis ", "Sorocea pubivena ", "Sorocea trophoides ", "Trophis mexicana ", "Trophis racemosa" }; caracteristicas = new String[27, 8] { {"Aserrado", "Elíptica", "Larga", "Angosta", "Largo", "Brillante", "Glabro", "Pocas"}, {"Aserrado", "Romboidal", "Larga", "Ancha", "Corto", "Opaco", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Corto", "Opaco", "Glabro", "Pocas"}, {"Entero", "Obovada", "Larga", "Ancha", "Corto", "Brillante", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Corto", "Brillante", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Corto", "Brillante", "Glabro", "Muchas"}, {"Entero", "Oblonga", "Larga", "Angosta", "Corto", "Opaco", "Glabro", "Muchas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Corto", "Brillante", "Glabro", "Pocas"}, {"Entero", "Oblonga", "Larga", "Angosta", "Corto", "Opaco", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Larga", "Angosta", "Largo", "Brillante", "Glabro", "Muchas"}, {"Entero", "Ovada", "Larga", "Ancha", "Corto", "Brillante", "Glabro", "Muchas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Corto", "Brillante", "Pubescente", "Pocas"}, {"Entero", "Ovada", "Larga", "Ancha", "Corto", "Brillante", "Pubescente", "Pocas"}, {"Entero", "Obovada", "Larga", "Ancha", "Corto", "Brillante", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Larga", "Angosta", "Corto", "Brillante", "Glabro", "Muchas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Largo", "Brillante", "Glabro", "Pocas"}, {"Entero", "Ovada", "Larga", "Ancha", "Corto", "Opaco", "Glabro", "Pocas"}, {"Entero", "Ovada", "Larga", "Ancha", "Corto", "Brillante", "Pubescente", "Pocas"}, {"Entero", "Oblonga", "Larga", "Angosta", "Corto", "Brillante", "Glabro", "Muchas"}, {"Entero", "Elíptica", "Larga", "Angosta", "Largo", "Brillante", "Glabro", "Muchas"}, {"Aserrado", "Lanceolada", "Corta", "Angosta", "Corto", "Brillante", "Glabro", "Muchas"}, {"Aserrado", "Elíptica", "Corta", "Angosta", "Corto", "Opaco", "Pubescente", "Muchas"}, {"Aserrado", "Elíptica", "Larga", "Ancha", "Largo", "Opaco", "Pubescente", "Muchas"}, {"Aserrado", "Oblonga", "Larga", "Ancha", "Largo", "Opaco", "Glabro", "Pocas"}, {"Aserrado", "Elíptica", "Larga", "Angosta", "Largo", "Brillante", "Glabro", "Pocas"}, {"Entero", "Elíptica", "Corta", "Angosta", "Largo", "Opaco", "Glabro", "Pocas"}, {"Aserrado", "Elíptica", "Larga", "Ancha", "Largo", "Opaco", "Glabro", "Pocas"} }; }
protected void LoadValues() { comboBoxParent.Items.Clear(); rubList = ModelClothes.I().GetRubs(); subRubList = ModelClothes.I().GetSubRubs(); for (int i = 0; i < rubList.Length / 2; i++) { if (rubList[i, 1] != "") { comboBoxParent.Items.Add(rubList[i, 1]); } } comboBoxParent.SelectedIndex = 0; if (itemId != 0) { OleDbDataReader it = ModelPrihodnayaNakladnayaIt.I().GetById(itemId.ToString()); if (it != null) { it.Read(); textName.Text = it["name"].ToString(); textCount.Text = it["count"].ToString(); textCena.Text = it["price"].ToString(); } } }
public TicTacToeTransaction(String[,] board, int x, int y, Boolean playerXTurn) { this.board = board; this.x = x; this.y = y; this.playerXTurn = playerXTurn; }
public Table(String[,] content) { _content = content; var jagged = content.ToJagged(); (jagged.Length > 1).AssertTrue(); (jagged[0].Length > 1).AssertTrue(); (jagged.Min(dim => dim.Length) == jagged.Max(dim => dim.Length)).AssertTrue(); Columns = jagged[0].Skip(1).Select(s => s.Substring(0, s.IndexOf(':'))).ToArray(); Rows = jagged.Skip(1).Select(dim => dim[0]).ToArray(); Data = jagged.Skip(1).Select(dim => dim.Skip(1).ToArray()).ToArray(); var ctypes = jagged[0].Skip(1).Select(s => s.Substring(s.IndexOf(':') + 1)).ToArray(); ColumnTypes = ctypes.Select((ctype, i) => { var t = ContentTypes.All.SingleOrDefault(w => String.Compare( w.LocTypeName, ctype.ToLower(), true) == 0); if (t == null) { var s_wrappers = ContentTypes.All.Select(w => w.LocTypeName); throw new ValidationException(Resources.TableImport_BadFormatOfColumnHeader, ctype, s_wrappers.StringJoin()); } return t; }).ToArray(); }
void Form1_Load(object sender, EventArgs e) { Program.ArkRcon.Run(); Program.ArkRcon.ServerConnectionStarting += ArkRcon_ServerConnectionStarting; Program.ArkRcon.ServerConnectionFailed += ArkRcon_ServerConnectionFailed; Program.ArkRcon.ServerAuthSucceeded += ArkRcon_ServerAuthSucceeded; Program.ArkRcon.ServerAuthFailed += ArkRcon_ServerAuthFailed; Program.ArkRcon.ConsoleLogUpdated += ArkRcon_ConsoleLogUpdated; IPAddress[] localIP = Dns.GetHostAddresses(Dns.GetHostName()); //Local IP Info foreach (IPAddress address in localIP) { if (address.AddressFamily == AddressFamily.InterNetwork) { label7.Text = address.ToString(); } } TitlesBox.Items.Clear(); rssData = getRssData(ChannelTextBox.Text); for (int i = 0; i < rssData.GetLength(0); i++) { if (rssData[i, 0] != null) { TitlesBox.Items.Add(rssData[i, 0]); } TitlesBox.SelectedIndex = 0; } }
public Matrix(int row, int col) { DataList = new String[row, col]; Columns = new ArrayList(); xCap = row; yCap = col; }
/* * Método al presionar el botón de Probar */ private void button1_Click(object sender, EventArgs e) { String letraIngresada = " "; if(textBox2.Text.ToString()!=""){ //si el usuario no ingresa nada y oprime el botón, pierde un turno letraIngresada = textBox2.Text.ToString(); } hidden = ws.checkAndReplace(letraIngresada, hidden, answer, answer.Length); //revisa y reemplaza (si hubo acierto) el intento del jugador textBox2.Text = ""; if(ws.checkGameOver(answer, hidden)==0){ //Juego perdido /* deshabilita botones y campos de texto */ textBox1.Enabled = false; textBox2.Enabled = false; Probar.Enabled = false; pictureBox1.Load("http://titanic.ecci.ucr.ac.cr/~eb02430/TP2/hang/hang10.gif"); pictureBox2.Load("http://titanic.ecci.ucr.ac.cr/~eb02430/TP2/hang/hangFinal.jpg"); //carga imagen de pérdida rows = ws.select(); //select del top ten de mejores tiempos topTen = new String[rows.Length, 2]; Top.Enabled = true; //se habilita la opción de mostrar el top ten intentos--; label5.Visible = true; label5.Text += " Respuesta: " + answer; }else{ colocarResultado(hidden); //coloca palabra escondida en pantalla if (ws.checkGameOver(answer, hidden) == 1){ //Juego ganado /* deshabilita botones y campos de texto */ textBox1.Enabled = false; textBox2.Enabled = false; Probar.Enabled = false; ws.insert(usuario, ws.getTime()); //inserta el jugador y tiempo en la BD pictureBox2.Load("http://titanic.ecci.ucr.ac.cr/~eb02430/TP2/hang/like.jpg"); //carga imagen ganadora /* select a la BD y habilitación para ver el top ten */ rows = ws.select(); topTen = new String[rows.Length, 2]; Top.Enabled = true; label6.Visible = true; } else { if (ws.checkGameOver(answer, hidden) == -1) { //Intento fallido pictureBox1.Load("http://titanic.ecci.ucr.ac.cr/~eb02430/TP2/hang/hang"+cont+".gif"); //se carga la imagen formando el ahorcado cont++; //para cargar la siguiente imagen intentos--; //un intento menos por fallar } } } label3.Text = intentos.ToString(); //actualización de los intentos en pantalla }
public String[,] getOrderDetails() { FuelItem[] x= managerClient.getFuelOrders(); fuelOrders = new String[2, 3]; float dieselVol = 0; float dieselCost = 0; float unleadedVol = 0; float unleadedost = 0; for ( int i = 0; i < x.Length; i++) { if (x[i] == null) break; if (x[i].Type == "unleaded") { unleadedVol += x[i].Amount; unleadedost += x[i].Value; } else if(x[i].Type=="diesel") { dieselVol += x[i].Amount; dieselCost += x[i].Value; } } fuelOrders[0, 0] = "Unleaded"; fuelOrders[0, 1] = unleadedVol.ToString(); fuelOrders[0, 2] = unleadedost.ToString(); fuelOrders[1, 0] = "Diesel"; fuelOrders[1, 1] = dieselVol.ToString(); fuelOrders[1, 2] = dieselCost.ToString(); return fuelOrders; }
private void addShipWreck() { ship = new String[24, 5] { {"A empleo", prop,"Grain","1912",detroit}, {"Addison W", prop, "Coal", "1912", detroit}, {"D Breaux", steam, "Coal", "1881", sault}, {"Deidre E Sullivan", wood, "Coal", "1854",sault}, {"Double R Rupan", steam, "Grain", "1873", sault}, {"Erica Moulton", steam, "Grain", "1873", detroit}, {"Fraser", prop, "Coal", "1909", sault}, {"Gordon G", steam, "Coal", "1881", detroit}, {"J Gray", wood,"Grain", "1854", detroit}, {"J Hertzberg",prop,"Grain", "1912", sault}, {"Jann Hooyer", wood, "Grain", "1854", sault}, {"Jill M Zande", steam, "Coal", "1873", detroit}, {"Justin M",prop, "Coal", "1912", sault}, {"Kathryn L", steam,"Grain", "1881", sault}, {"L Hebert", wood, "Coal", "1873", detroit}, {"T Lunsford",prop, "Grain", "1909", detroit}, {"Matthew E", steam, "Coal", "1873", sault}, {"Rachel G", wood, "Grain", "1873", sault}, {"S Gandulla", prop, "Coal", "1909", detroit}, {"Sarah W", steam, "Grain", "1881", detroit}, {"Stahr Liner", prop, "Grain", "1909", sault}, {"T Sinclair", wood, "Coal", "1873", sault}, {"Tony S", wood, "Coal", "1854", detroit}, {"W Thompson", wood, "Grain", "1873", detroit} }; }
public Map() { walls = new List<Wall>(); players = new List<Player>(); tokens = new List<Token>(); Token.tokenNum = 0; Player p1 = new Player(); Player p2 = new Player(); p1.setName(Settings.getInstance().getPlayer1Name()); p2.setName(Settings.getInstance().getPlayer2Name()); players.Add(p1); players.Add(p2); //width = 13; //height = 19; width = (Settings.getInstance().getWidth() * 2) + 1; height = (Settings.getInstance().getHeight() * 2) + 3; board = new String[width+2, height+2]; initializeBoard(); placeTokens(); coverageCheck = new int[width, height]; resetCovereage(); }
private TMConfigure TMConfig; // configuration of Turing Machine #endregion Fields #region Constructors //-------------------------------------------------------------------------------- // TMSourceCode() // In: - // Out: - // Description: initialisation of vars public TMSourceCode() { linesOfCode = new ArrayList(); TMCode = new ArrayList(); TMConfig = new TMConfigure(); TMCodeMatrix = new String[1, 1]; }
// Empty => Denotes the cell is free // B_<index> => Denotes the cell is a brick and the index of the brick // W_<index> => Denotes the cell is a water and the index of the water // M_<index> => Denotes the medipack // C_<index> => Deotes the Coin Pile // P_<index> => Denotes the Palyer in the map. public Map(String initialMessage,String startString) { this.mapSize = 20; map = new String[20, 20]; this.initialMessage = initialMessage; this.numbberOfStoneCells = 0; this.numberOfBrickCells = 0; this.numebrOfWataterCells = 0; this.numberOfPlayers = 0; this.coinPiles = new List<Item>(); this.lifePacks = new List<Item>(); for (int i = 0; i < mapSize; i++) { for (int j = 0; j < mapSize; j++) { map[i, j] = "Empty"; } } if (this.processInitialString(initialMessage) & this.processStartString(startString)) { Console.WriteLine("Map Initialization Sucessfull"); } else { Console.WriteLine("Error Occured While initializing the Map"); } }
public Story(Player[] playersList) { looser = 0; finalist1 = 0; finalist2 = 0; winner = 0; storyDone = false; intro = true; ending = false; cutscene = false; players = playersList; script = new String[7,7]; pageNumber = 0; secondaryPageNumber = 0; miniGameNumber = 0; miniGameReady = false; script[0,0] = "An evil wizard named Kostaba once lived in a \n\n faraway place. Despite being evil, he was a \n\n regular person when it came to hobbies. He enjoyed \n\n fishing, baseball but most of all gaming. \n\n His favorite game was Battle Rooms, a multiplayer \n\n party game (yes like Mario Party) created by \n\n four young developers. One day, Kostaba grew \n\n weary of the same old games."; script[1, 0] = "So Kostaba did what any rational evil wizard \n\n would do; he kidnapped the game developers \n\n and trapped them in a room. After the wizard \n\n demanded them to create for him a new Battle Rooms \n\n game, the lead developer explained that this \n\n could not be done since the copyrights belonged \n\n to Apple."; script[2, 0] = "A new idea arose, the wizard could re create \n\n the game using his spectacular magic \n\n powers while the developers would compete for \n\n the championship. The prize for victory would be a \n\n single wish granted by the wizard . . ."; script[3,0] = " . . ."; script[3, 0] = "Your next test will be a team game. We will \n\n balance out the teams by matching 1st \n\n place with last place."; script[3, 1] = " seem\'s to be having a hard time. \n\n However! This can still be anybody\'s game. \n\n Our lucky loser has a chance to redeem themselves \n\n with a win on this 1 vs. 3 type game."; script[3, 2] = " Ladies and gentlemen, our two finalists \n\n await their final test. Who will be the \n\n last one standing . . . "; script[3, 3] = "CONGRATULATIONS!! \n\n you have won, what is your wish?"; script[4, 0] = "Even though these games were fun, the hero \n\n wished to return home with the rest of the team. \n\n They all missed their families and their day \n\n jobs as game developers. After crying for 6 \n\n hours, the wizard finally fulfilled his promise \n\n and granted the wish. He would have to wait \n\n for Battle Rooms 2 like everyone else."; }
public ViewMessage(Model.ModelLevel levelModel, Controller.Player[] aPlayers) { InitializeComponent(); this.levelModel = levelModel; this.aPlayers = aPlayers; viewMap = new String[levelModel.IMapHeight, levelModel.IMapWidth]; }
private void ExpandY() { yCap *= 2; String[,] cur = new String[xCap, yCap]; for (int x = 0; x < xCount; x++) for (int y = 0; y < yCount; y++) cur[x, y] = DataList[x, y]; DataList = cur; }
public SolverEngine(int rank, String[,] _TableToSolve, List<Tuple<int, int>> _FixedPositions, Delegate _EndCallback) { tableToSolve = _TableToSolve; fixedPositions = _FixedPositions; endCallback = _EndCallback; TABLEWIDTH = rank; TABLEHEIGHT = rank; MAXVALUE = rank; }
public World(Game1 game, GameplayScreen gps, int x, int y) { this.game = game; screen = gps; currentX = x; currentY = y; collisionMaps = new String[worldWidth, worldHeight]; backgrounds = new String[worldWidth, worldHeight]; }
public SaveFile(Lingo lingoGame, WordManager wordManager, Colors[] result, Colors[] foundLetters, Colors[,] earlierResult, String[,] earlierLetters) { this.lingoGame = lingoGame; this.wordManager = wordManager; this.result = result; this.foundLetters = foundLetters; this.earlierLetters = earlierLetters; this.earlierResult = earlierResult; }
private DecodeOperations() { this.map = new String[GRID_SIZE, GRID_SIZE]; this.playerList = new List<Player>(); this.brickList = new List<Brick>(); this.coinList = new List<Coin>(); this.lifePackList = new List<LifePack>(); this.stoneList = new List<Stone>(); this.waterList = new List<Water>(); }
private static void InstantiateCustomMatrix() { int[] rowsCols = GetRowsColsFromConsole(); _rows = rowsCols[0]; _cols = rowsCols[1]; _matrix = new String[_rows, _cols]; _result = new List<String>(); PopulateMatrixFromConsole(); }
private static void InstantiateMatrixFromExampleA() { _rows = 3; _cols = 4; _matrix = new String[,] { {"ha", "fifi", "ho", "hi"}, {"fo", "ha", "hi", "xx"}, {"xxx", "ho", "ha", "xx"}, }; _result = new List<String>(); }
private static void InstantiateMatrixFromExampleB() { _rows = 3; _cols = 3; _matrix = new String[,] { {"s", "qq", "s"}, {"pp", "pp", "s"}, {"pp", "qq", "s"} }; _result = new List<String>(); }
public String[,] getFuelLevels() { FuelItem[] x= managerClient.getFuelLevels(); fuelLevels = new String[x.Length,2]; for (int i = 0; i < x.Length; i++) { fuelLevels[i, 0] = x[i].Type; fuelLevels[i, 1] = x[i].Amount.ToString(); } return fuelLevels; }
public StartingHandChart() { String[,] table2 = new String[14,14]; String[] ranks2 = { "A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3", "2" }; List<String> _p62 = new List<String>(); List<String> _p58 = new List<String>(); List<String> _p55 = new List<String>(); List<String> _p52 = new List<String>(); List<String> _p50 = new List<String>(); for(int i = 0; i < 14; i++ ) { for(int j = 0; j < 14; j++ ) { if (i == 0 && j > 0) table2[0, j] = ranks2[j - 1]; if( j == 0 && i > 0) table2[i,0] = ranks2[i-1]; } } for(int i = 1; i < 14; i++ ) { for(int j = 1; j < 14; j++ ) { table2[i,j] = table2[0,j] + table2[i,0]; } } String[] data = { "AA", "AK", "AQ", "AJ", "A10", "A9", "A8", "AKO", "AQO", "AJO", "A10O", "KQ", "KJ", "KK", "QQ", "JJ", "1010", "99", "88", "77", "66"}; _p62.AddRange(data); String[] data2 = { "55", "A7", "A6", "A5", "A4", "A3", "K10", "K9", "K8", "QJ", "Q10", "A9O", "A8O", "A7O", "KQO", "KJO", "K10O", "QJO"}; _p58.AddRange(_p62); _p58.AddRange(data2); String[] data3 = { "A6O", "A5O", "A4O", "A3O", "K9O", "K8O", "K7O", "Q10O", "44", "A2", "K7", "K6", "K5", "Q9", "Q8", "J9", "J10"}; _p55.AddRange(_p58); _p55.AddRange(data3); String[] data4 = { "33", "K4", "K3", "K2", "Q7", "Q6", "Q5", "J8", "109", "A2O", "K6O", "K5O", "K4O", "Q9O", "Q8O", "J10O", "J9" }; _p52.AddRange(_p55); _p52.AddRange(data4); String[] data5 = { "Q4", "Q3", "Q2", "22", "J7", "J6", "J5", "108", "107", "98", "K3O", "K2O", "Q7O", "Q6O", "Q5O", "J8O", "109O" }; _p50.AddRange(_p52); _p50.AddRange(data5); this.p62 = _p62; this.p58 = _p58; this.p55 = _p55; this.p52 = _p52; this.p50 = _p50; this.table = table2; this.ranks = ranks2; }
static void Main(string[] args) { //ACHTUNG! //Input format, in the problem description, is wrong //Provide the input AS SHOWN IN THE PROBLEM EXAMPLES _rows = int.Parse(Console.ReadLine()); _cols = int.Parse(Console.ReadLine()); _matrix = new String[_rows, _cols]; PopulateMatrix(); ShuffleMatrix(); }
public void SetRubs() { comboBoxParent.Items.Clear(); rubsList = modelClothes.GetRubs(); for (int i = 0; i < rubsList.Length / 2; i++) { if (rubsList[i, 1] != "") { comboBoxParent.Items.Add(rubsList[i, 1]); } } comboBoxParent.SelectedIndex = 0; }
public void LoadContent(ContentManager Content) { parse.LoadContent(Content); map = parse.backgroundMap(); for (int i = 0; i <= map.GetLength(0) - 1; i++) { Image pic = new Image(); pic.LoadContent(Content, map[i, 4], Color.White, new Vector2(int.Parse(map[i, 0]), int.Parse(map[i, 1]))); pic.scale = new Vector2(float.Parse(map[i,2], CultureInfo.InvariantCulture.NumberFormat), float.Parse(map[i, 3], CultureInfo.InvariantCulture.NumberFormat)); listImage.Add(pic); } }
public Archivo() { //nodos vector = new List<string>(); for (int i = 0; i < 188; i++) { vector.Add(Convert.ToString(i)); } N = new List<string>(); R = ""; Adyacencias = new String[2800, 2]; datos = new int[188, 188]; }
public MainWindow() { InitializeComponent(); ReadCsv(); dataSet = new String[array[0].Count, array.Length]; for (int j = 0; j < array[0].Count; j++) { for (int i = 0; i < array.Length; i++) { dataSet[j, i] = Convert.ToString(array[i][j]); } } array = null; }
public Flotte() { _grille = new String[FORMAT, FORMAT]; _flotte = new Navire[NBRENAVIRES]; //Créer les navires for (int noNav = 0; noNav < NBRENAVIRES; ++noNav) { this._flotte[noNav] = new Navire(TAILLESNAVIRES[noNav], NOMSNAVIRES[noNav]); } initGrille(); }
static void Main(string[] args) { String[,] world = initTheWorld(20, 50); // GetUpperBound(0) and GetUpperBound(1) return 4 in 5x5 matrix int matrixRowCount = world.GetUpperBound(0) + 1; int matrixColumnCount = world.GetUpperBound(1) + 1; String randomSnakeCordinate = snakeRandomCordinate(matrixRowCount, matrixColumnCount); int randomSnakeCordinateX = Convert.ToInt32(randomSnakeCordinate[0].ToString()); int randomSnakeCordinateY = Convert.ToInt32(randomSnakeCordinate[2].ToString()); world[randomSnakeCordinateX, randomSnakeCordinateY] = "S"; printTheWorld(world); userInputs(world, randomSnakeCordinate); }
private double findTheMatchingValueWithTheExactStar(String starName, String[,] knownValues) { int lengthoftable = knownValues.Length - 1; double knownValue = 0; //declare a variable that will hold the value of the default brightness of the star for (int j = 0; j <= 19; j++) { //for loop from the begining of the list to the end if (starName == knownValues[j, 0]) { //if there is a match or the name of the star exists then the variable get the value of the brightness corresponding to that name knownValue = double.Parse(knownValues[j, 1]); break; //breaking the loop because no need to keep looking for a match, as we already found it } } //return the brightness value return(knownValue); }
public static bool TerminalState(String[,] board) { if (DiscsOnBoard(board) == 64) { return(true); } if (CountWhiteTokens(board) == 0) { return(true); } if (CountBlackTokens(board) == 0) { return(true); } return(false); }
public static void printBoard(String[,] bOARD) { String b = ""; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { b = b + bOARD[i, j] + " "; } b += "\n"; } Debug.Log(b); Console.WriteLine(b); }
public static int CountBlackTokens(String[,] board) { int count = 0; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i, j] == "B") { count++; } } } return(count); }
public static int DiscsOnBoard(String[,] board) { int count = 0; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (board[i, j] != "E") { count++; } } } return(count); }
public MainWindow() { InitializeComponent(); ReadCsv(); dataSet = new String[array[0].Count, array.Length]; for (int j = 0; j < array[0].Count; j++) { for (int i = 0; i < array.Length; i++) { dataSet[j, i] = Convert.ToString(array[i][j]); } } array = null; }
public static bool mainMenuAuth(String[,] auth, String menu_id) { bool found = false; for (int arrayIndex = 0; arrayIndex < auth.GetLength(0); arrayIndex++) { //GF.doDebug("[ CHECK AUTH :: MAIN ] >>> " + menu_id + " : " + auth[arrayIndex, 0]); if (auth[arrayIndex, 0] == menu_id.ToString()) { found = true; break; } } return(found); }
public int mapFromString(String[,] map, int width, int height) { field = new Field(width, height); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (map[i, j] == "1") { countElem++; } } } if (countElem % 4 == 0) { countTypes = countElem / 4; countImagesInType = 4; } else if (countElem % 2 == 0) { countTypes = countElem / 2; countImagesInType = 2; } else { return(-1); } field.initField(countTypes, countImagesInType, false); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (map[i, j] == "1") { field.array[i, j].setState(1); } } } field.generateField(); return(0); }
protected void Page_Load(object sender, EventArgs e) { InitializeArray(); EmployeesInformation = (((Business)Application["Business"])).getEmployeesInformation(); if (Session["Title"] == null) { Response.Redirect("StartPage.aspx"); } else if (Session["Title"].ToString() != "Vice President, Sales") { Response.Redirect("Maintenance.aspx"); } else { if (!IsPostBack) { // If there is valid session varavle, load the employee informations if (Session["Editing Employee Item"] != null) { for (int i = 0; i < EmployeesInformation.GetLength(0); i++) { if ((String)Session["Editing Employee Item"] == EmployeesInformation[i, 0]) { for (int j = 0; j < textBoxArray.Length; j++) { textBoxArray[j].Text = EmployeesInformation[i, j]; } } } //Edit setting: Allow Update,Delete btnUpdate.Visible = true; btnDelete.Visible = true; btnInsert.Visible = false; } else { // Insert setting btnUpdate.Visible = false; btnDelete.Visible = false; btnInsert.Visible = true; } } textBoxArray[1].Focus(); } }
public void startGame() { //Console.SetWindowSize (32, 13); //Console.SetBufferSize (32, 13); gb = new Display(); ui = new UserInput(); setPlayerBoards(); isPlayerOne = true; winDecided = false; turn = 0; while (winDecided == false) { isDemo = false; Console.Clear(); gb.updateDisplay(); c = ui.askChoice(isPlayerOne); if (c == 69) { demoMode(); } else { Boolean canAdd = gb.addPiece(isPlayerOne, c); while (canAdd == false) { c = ui.askChoice(isPlayerOne); canAdd = gb.addPiece(isPlayerOne, c); } board = gb.getBoard(); int steps = gb.getSteps(); addPiece(isPlayerOne, c, steps); Console.Clear(); gb.updateDisplay(); checkWin(c, steps, isPlayerOne); changePlayer(isPlayerOne); turn++; if (turn == (board.GetLength(0) * board.GetLength(1))) { winDecided = true; } if (winDecided == true) { displayWinner(); } } } }
public static void HitFive(int x, int y, int rows, int cols, String[,] poleZaRabota) { HitFour(x, y, rows, cols, poleZaRabota); if (x - 2 > 1 && y - 4 > 1) { poleZaRabota[x - 2, y - 4] = "X"; } if (x < rows - 2 && y - 4 > 1) { poleZaRabota[x + 2, y - 4] = "X"; } if (y == 18) { if (x < rows - 2) { poleZaRabota[x + 2, y + 2] = "X"; } if (x - 2 > 1) { poleZaRabota[x - 2, y + 2] = "X"; } } else if (y == 20) { if (x < rows - 2) { poleZaRabota[x + 2, y] = "X"; } if (x - 2 > 1) { poleZaRabota[x - 2, y] = "X"; } } else { if (x < rows - 2 && y < cols - 3) { poleZaRabota[x + 2, y + 4] = "X"; } if (x - 2 > 1 && y < cols - 3) { poleZaRabota[x - 2, y + 4] = "X"; } } }
/* <----------------END of the function HERE-------------------------------> */ static void Main() { string input, opt = "y"; const int rowSize = 8, colSize = 8;// constant integar declare // initializing the array with '?' (hidden board) String[,] hiddenBoard = new string[rowSize, colSize]; Console.WriteLine(); Console.WriteLine(" 1 2 3 4 5 6 7 8"); Console.WriteLine("-----------------------------------"); for (int x = 0; x < colSize; x++) { Console.Write(" "); Console.Write( x+1 +" | "); for (int y = 0; y < rowSize; y++) { hiddenBoard[x, y] = "?"; // Assigning Values to the hiddenBoard Console.Write(hiddenBoard[x,y] + " " ); // Displaying the hidden board } Console.WriteLine(); } Console.WriteLine(" ----------------------------------- "); Console.WriteLine(" * * *************************** * *"); Console.WriteLine(" * * Find GOLD * *"); Console.WriteLine(" * * You have 5 guesses, * *"); Console.WriteLine(" * * 5 pieces of Gold * *"); Console.WriteLine(" * * And 1 Bomb * *"); Console.WriteLine(" * * GOOD LUCK! * *"); Console.WriteLine(" * * *************************** * *"); do { GoldFinding obj = new GoldFinding();// creatin object for function call String[,] GandB = obj.settingGoldandBomb(hiddenBoard);// Function Call int score= obj.goldCheck(GandB); //Function Call Console.WriteLine(" You Earn " + score + " points"); Console.WriteLine(" Better Luck Next Time !! "); Console.WriteLine(" Here is your board "); obj.disply(GandB); // parsing Array to the function Console.WriteLine(" Enter y to play again "); input= Console.ReadLine(); } while (string.Compare(opt,input)==0); Console.ReadKey(); } // End Main( )
public Block(String[,] _blck) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { switch (_blck[i, j]) { case "A": blck[i, j].Num = 10; break; case "B": blck[i, j].Num = 11; break; case "C": blck[i, j].Num = 12; break; case "D": blck[i, j].Num = 13; break; case "E": blck[i, j].Num = 14; break; case "F": blck[i, j].Num = 15; break; default: int num = Convert.ToInt32(_blck[i, j]); if (num >= 0 && num <= 9) { blck[i, j].Num = num; } else { blck[i, j].Num = -1; } break; } } } }
private void LoadQuoteDataItem(String date) { ordervo = new VO.OrderVO(); ordervo.Targetdate = presetDate; String[,] grabData = ordervo.ReadQuoteHistoryDateVO(); try { for (int o = 0; o < grabData.GetLength(1); o++) { dataGridView1.Rows.Add(grabData[0, o].ToString(), Convert.ToDateTime(grabData[1, o]).ToString("MM/dd/yyyy"), Convert.ToDateTime(grabData[2, o]).ToString("hh:mm:ss tt"), grabData[3, o].ToString(), grabData[4, o].ToString(), Convert.ToDouble(grabData[5, o]).ToString("#,###,##0.00"), grabData[6, o].ToString()); } } catch (Exception) { MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static int CreateMore(String[,] data, String ProjectID) { #region 检查输入的合法性 if (data == null) { return(0); } try { for (int i = 0; i < data.GetLength(0); i++) { int num = Convert.ToInt32(data[i, 2]); } } catch { return(0); } #endregion #region 把数据组装成对象 List <Models.DB.RecommendedInfo> list = new List <Models.DB.RecommendedInfo>(); for (int i = 0; i < data.GetLength(0); i++) { Models.DB.RecommendedInfo model = new Models.DB.RecommendedInfo(); model.Name = data[i, 0]; model.Sex = data[i, 1]; model.Age = Convert.ToInt32(data[i, 2]); model.Title = data[i, 3]; model.WorkUnits = data[i, 4]; model.Address = data[i, 5]; model.PostalCode = data[i, 6]; model.Phone = data[i, 7]; model.HomePhone = data[i, 8]; model.Elaborate = data[i, 9]; model.Evaluate = data[i, 10]; model.Remark = data[i, 11]; model.ProjectID = Convert.ToInt32(ProjectID); list.Add(model); } #endregion return(DAL.Create.CreateList(list)); }
public wfDetalleFactura() { InitializeComponent(); /////////////////////////////////////// //Datos Grid factura String[,] Scaden = { { "numero_factura", "Codigo", "true" }, { "nit_cliente", "NIT", "true" }, { "id_usuario", "ID usuario", "true" }, { "id_pacientes", "ID pacientes", "false" }, { "fecha", "Fecha", "true" }, }; cuDataGridD2.AlDatosEntrada.Add(Scaden); cuDataGridD2.vinicializar(); /////////////////////////////////// }
public String postCommit() { try { int selectedIndex = int.Parse(System.Web.HttpContext.Current.Request["connectionIndex"]); String[,] connectionStrings = (String[, ])System.Web.HttpContext.Current.Application["ConnectionStrings"]; NpgsqlConnection connection = new NpgsqlConnection(connectionStrings[selectedIndex, 0]); connection.Open(); NpgsqlCommand command = new NpgsqlCommand(System.Web.HttpContext.Current.Request["query"], connection); int linhasAfetadas = command.ExecuteNonQuery(); connection.Close(); return(String.Format("Commit efetuado com sucesso. {0} linhas afetadas.", linhasAfetadas)); } catch (Exception ex) { return(ex.Message); } }
private void LoadQuoteDataItem(Int32 Quotation_no) { ordervo = new VO.OrderVO(); ordervo.Quotation_no = Quotation_no; String[,] grabData = ordervo.ReadItemQuote(); try { for (int o = 0; o < grabData.GetLength(1); o++) { dataGridView1.Rows.Add(grabData[0, o].ToString(), grabData[1, o].ToString(), grabData[2, o].ToString(), Convert.ToDouble(grabData[3, o].ToString()).ToString("#,###,##0.00"), Convert.ToDouble(grabData[4, o].ToString()).ToString("#,###,##0.00")); } } catch (Exception) { MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ParseTest4_QuotedSpecialChars() { StringReader sin = new StringReader("\"1,\n\r\",\"2,\n\r\"\r\n\"6,\n\r\",\"7,\n\r\"\r\n"); String[,] answer = { { "1,\n\r", "2,\n\r" }, { "6,\n\r", "7,\n\r" } }; int recno = 0; CsvParser.Parse( sin, (strings) => { Assert.AreEqual(2, strings.Length); Assert.AreEqual(answer[recno, 0], strings[0]); Assert.AreEqual(answer[recno, 1], strings[1]); ++recno; }); }
static public void boatInitialiseTab(String[,] pBoarList) { pBoarList[0, 0] = "Plane Carrier"; pBoarList[0, 1] = "5"; pBoarList[1, 0] = "Croiseur"; pBoarList[1, 1] = "4"; pBoarList[2, 0] = "Contre Torpilleur"; pBoarList[2, 1] = "3"; pBoarList[3, 0] = "Contre Torpilleur"; pBoarList[3, 1] = "3"; pBoarList[4, 0] = "Torpilleur"; pBoarList[4, 1] = "2"; }
public GoToTable(String[] nonTerminalChar = null, int maxState = 0) { this.maxState = maxState; this.nonTerminalChar = nonTerminalChar; int num1 = maxState + 1; int num2 = this.nonTerminalChar.Length; goToTable = new String[num1, num2]; //初始化表格内容均为空 for (int i = 0; i < num1; i++) { for (int j = 0; j < num2; j++) { goToTable[i, j] = ""; } } }
private void LoadData() { customer = new VO.CustomersVO(); String[,] grabData = customer.ReadCustomers(); try { dataGridView1.Rows.Clear(); for (int x = 0; x < grabData.GetLength(1); x++) { dataGridView1.Rows.Add(grabData[0, x].ToString(), grabData[1, x].ToString(), grabData[2, x].ToString(), grabData[3, x].ToString(), grabData[4, x].ToString(), Convert.ToDouble(grabData[5, x].ToString()), Convert.ToDateTime(grabData[6, x]).ToString("MM/dd/yyyy")); } } catch (Exception) { MessageBox.Show("Check Database!", "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void ParseTest5_Escaped() { StringReader sin = new StringReader("\"\"\"1\"\"\",\"\"\"2\"\"\"\r\n\"\"\"6\"\"\",\"\"\"7\"\"\"\r\n"); String[,] answer = { { "\"1\"", "\"2\"" }, { "\"6\"", "\"7\"" } }; int recno = 0; CsvParser.Parse( sin, (strings) => { Assert.AreEqual(2, strings.Length); Assert.AreEqual(answer[recno, 0], strings[0]); Assert.AreEqual(answer[recno, 1], strings[1]); ++recno; }); }
private void getTerminal() { try { config = new VO.ConfigVO(); cBTerminal.Items.Clear(); String[,] grabData = config.ReadTerminal(); for (int x = 0; x < grabData.GetLength(1); x++) { cBTerminal.Items.Add(grabData[0, x].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void drawProof(String[,] matrix, List <Connection> connections) { canvas.Children.Clear(); this.matrix = matrix; this._colWidth = new double[this.matrix.GetLength(0)]; this._colOffset = new double[this.matrix.GetLength(0)]; drawConnections(connections); drawMatrix(); drawBrackets(); Size canvasSize = drawingSize(); canvas.Width = canvasSize.Width; canvas.Height = canvasSize.Height; }
private static void Main(string[] args) { String username; String password; String[,] accnts = { { "mukes", "dada" }, { "admin", "fafa" }, { "admin", "gaga" } }; int row; bool isValideUser = false; for (int x = 3; x >= 1; x--) { Console.WriteLine("You have " + x + " attempt/s."); Console.Write("Enter Username>> "); username = Console.ReadLine(); Console.Write("Enter Password>> "); password = Console.ReadLine(); for (row = 0; row < 3; row++) { if (username.Equals(accnts[row, 0]) && password.Equals(accnts[row, 1])) { Console.WriteLine("Welcome " + accnts[row, 0] + "!"); isValideUser = true; break; } } if (!isValideUser) { Console.WriteLine("Invalid Input."); if (x != 1) { Console.WriteLine("Please Try Again."); Console.Write("\n"); } else if (x.Equals(1)) { Console.Write("Goodbye!"); break; } } else { break; } } Console.ReadKey(); }
static String ParseParameters(String[,] parms) { if (parms == null || parms.Length == 0) { return(String.Empty); } var sb = new StringBuilder(); String token = "?"; for (Int32 i = 0; i < parms.Length - 1; i++) { sb.AppendFormat("{0}{1}={2}", token, parms[i, 0], parms[i, 1]); token = "&"; } return(sb.ToString()); }
public static int[] buscarPlayer(String[,] matriz) { int[] posicion = new int[2]; for (int i = 0; i < 31; i++) { for (int j = 0; j < 28; j++) { if (matriz[i, j] == "<" || matriz[i, j] == ">" || matriz[i, j] == "V" || matriz[i, j] == "^") { posicion[0] = i; posicion[1] = j; } } } return(posicion); }
public Polaczenia() { InitializeComponent(); stop = false; PolTMT = new string[50, 2]; NazwyTMT = new string[50, 2]; WynikPol = new int[50, 2]; for (int i = 0; i < 50; i++)//czyszczenie tablic { for (int k = 0; k < 2; k++) { PolTMT[i, k] = ""; NazwyTMT[i, k] = ""; WynikPol[i, k] = 2; } }//czyszczenie teablic }