Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal class Program
- {
- private static void Main(string[] args)
- {
- string[] rysunkiWisielca = UtworzRysunkiWisielca();
- string[] tablicaHasel = UtworzTabliceHasel();
- string wylosowaneHaslo = WylosujHaslo(tablicaHasel);
- (string hasloDoWyswietlenia, int liczbaNieLiter) = ZakryjHaslo(wylosowaneHaslo);
- OdgadujHaslo(wylosowaneHaslo, hasloDoWyswietlenia, liczbaNieLiter, rysunkiWisielca);
- }
- private static void OdgadujHaslo(string wylosowaneHaslo, string hasloDoWyswietlenia, int liczbaNieLiter, string[] rysunkiWisielca)
- {
- throw new NotImplementedException();
- }
- private static (string hasloDoWyswietlenia, int liczbaNieLiter) ZakryjHaslo(string wylosowaneHaslo)
- {
- int liczbaNieLiter = 0;
- string hasloDoWyswietlenia = "";
- for (int i = 0; i < wylosowaneHaslo.Length; i++)
- {
- char znak = wylosowaneHaslo[i];
- if (char.IsLetter(znak))
- {
- hasloDoWyswietlenia += '_';
- }
- else
- {
- liczbaNieLiter++;
- hasloDoWyswietlenia += znak;
- }
- }
- return (hasloDoWyswietlenia, liczbaNieLiter);
- }
- private static string WylosujHaslo(string[] tablicaHasel)
- {
- string haslo = "";
- Random maszynaLosujaca = new Random();
- int wylosowanaLiczba = maszynaLosujaca.Next(tablicaHasel.Length);
- haslo = tablicaHasel[wylosowanaLiczba];
- return haslo;
- }
- static string[] UtworzTabliceHasel()
- {
- return new string[]{
- "ANDES",
- "SAHARA",
- "MISSISSIPPI",
- "ARCHIPELAG",
- "TUNDRA",
- "MONAKO",
- "KILIMANDZARO",
- "FIORD",
- "ZWROTNIK RAKA",
- "POLWYSEP IBERYJSKI"
- };
- }
- static string[] UtworzRysunkiWisielca()
- {
- return new string[]{
- @"
- +---+
- | |
- |
- |
- |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- |
- |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- | |
- |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- /| |
- |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- /|\ |
- |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- /|\ |
- / |
- |
- =========" ,
- @"
- +---+
- | |
- O |
- /|\ |
- / \ |
- |
- =========",
- @"
- +---+
- | |
- X |
- /|\ |
- / \ |
- |
- ========="
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement