Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- string cialoWeza = ">";
- const int LiczbaNagrod = 10;
- int wiersz = 10;
- int sumaPunktow = 0;
- //tab - tablica dla wartosci pozycji (kolumny) oraz znaku dla kazdej nagrody
- int[,] tab = new int[LiczbaNagrod, 2];
- //Wypisujemy nagrody
- for (int i = 0; i < tab.GetLength(0); i++)
- {
- tab[i, 0] = rnd.Next(0, Console.WindowWidth);
- tab[i, 1] = rnd.Next(65, 91);
- Console.SetCursorPosition(tab[i, 0], wiersz);
- Console.WriteLine((char)tab[i, 1]);
- }
- int kolumna = 0;
- do
- {
- for (int i = 0; i < tab.GetLength(0); i++)
- {
- if (tab[i, 0] == kolumna) //tu jest nagroda
- {
- sumaPunktow += 1; // (tab[i, 1] % 5 == 0 ? 10 :2;
- cialoWeza = (Convert.ToChar(tab[i, 1])) + cialoWeza;
- }
- }
- Console.SetCursorPosition(Math.Max(0, kolumna - (cialoWeza.Length + 1)), wiersz);
- Console.WriteLine(" " + cialoWeza);
- kolumna++;
- Console.SetCursorPosition(0, Console.WindowHeight - 2);
- Console.WriteLine("Liczba punktów: {0}", sumaPunktow);
- Thread.Sleep(150);
- } while (kolumna < Console.WindowWidth);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement