SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | using System.Collections.Generic; | |
3 | using System.Linq; | |
4 | ||
5 | namespace Wisielec | |
6 | { | |
7 | class Program | |
8 | { | |
9 | static bool sprawdzenieWygranej(string haslo, List<char> listaLiter) | |
10 | { | |
11 | foreach (char litera in haslo) | |
12 | { | |
13 | if (!listaLiter.Contains(litera) && litera != ' ') | |
14 | { | |
15 | return false; | |
16 | } | |
17 | } | |
18 | return true; | |
19 | } | |
20 | ||
21 | static void pokazUzyteLitery(List<char> listaLiter) | |
22 | { | |
23 | Console.Write("Użyte litery to: "); | |
24 | foreach (char litera in listaLiter) | |
25 | { | |
26 | Console.Write(litera + ", "); | |
27 | } | |
28 | Console.WriteLine(); | |
29 | } | |
30 | ||
31 | static void pokazHaslo(string haslo, List<char> listaLiter) | |
32 | { | |
33 | foreach (var litera in haslo) | |
34 | { | |
35 | if (listaLiter.Contains(litera)) | |
36 | { | |
37 | Console.Write(litera); | |
38 | } | |
39 | else if (litera == ' ') | |
40 | { | |
41 | Console.Write(" "); | |
42 | } | |
43 | else | |
44 | { | |
45 | Console.Write("_ "); | |
46 | } | |
47 | } | |
48 | } | |
49 | ||
50 | static void Main(string[] args) | |
51 | { | |
52 | List<string> listaHasel = new List<string>(); | |
53 | ||
54 | listaHasel.Add("hograwts legacy"); | |
55 | listaHasel.Add("god of war"); | |
56 | listaHasel.Add("fortnite"); | |
57 | listaHasel.Add("minecraft"); | |
58 | listaHasel.Add("animal crossing"); | |
59 | ||
60 | Random generatorLiczb = new Random(); | |
61 | int iloscHasel = listaHasel.Count; | |
62 | int wylosowanyIndexHasla = generatorLiczb.Next(iloscHasel); | |
63 | string haslo = listaHasel[wylosowanyIndexHasla]; | |
64 | List<char> listaUzytychLiter = new List<char>(); | |
65 | ||
66 | ||
67 | ||
68 | ||
69 | } | |
70 | } | |
71 | } |