Skip to content

Commit

Permalink
prueba
Browse files Browse the repository at this point in the history
  • Loading branch information
ne0x86 committed Oct 13, 2018
1 parent 0f5587d commit 07e7d34
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Juego Numero Secreto/Juego Numero Secreto.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2041
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Juego Numero Secreto", "Juego Numero Secreto\Juego Numero Secreto.csproj", "{875D41EF-8591-462A-9F18-59FF7E0CDCEC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{875D41EF-8591-462A-9F18-59FF7E0CDCEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{875D41EF-8591-462A-9F18-59FF7E0CDCEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{875D41EF-8591-462A-9F18-59FF7E0CDCEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{875D41EF-8591-462A-9F18-59FF7E0CDCEC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6BD06FD6-3E6F-4F8A-A0AD-5425938B68DD}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>Juego_Numero_Secreto</RootNamespace>
</PropertyGroup>

</Project>
67 changes: 67 additions & 0 deletions Juego Numero Secreto/Juego Numero Secreto/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using System;

namespace ConsoleApp10
{
class Program
{


static void Main(string[] args)
{
Console.WriteLine("Bienvenidos al juego del número secreto");
Console.ReadKey();
Console.WriteLine("Tienes que adivinar el número que estoy pensando entre 1 y 20...");
Random generador = new Random();
int numSecreto = generador.Next(21);
int intentos = 0;
while (intentos == 0)
{
Console.WriteLine("Primero elige la dificultad: 1 = fácil, 2 = mediana, 3 = difícil");
int diff = int.Parse(Console.ReadLine());
if (diff == 1)
{
intentos = 10;
}
else if (diff == 2)
{
intentos = 5;
}
else if (diff == 3)
{
intentos = 3;
}
else
{
Console.WriteLine("Dificultad no válida, introduce otro valor");
}
}
Console.WriteLine("Dime que número crees que es");
int prueba = int.Parse(Console.ReadLine());
if (prueba == numSecreto)
{
Console.WriteLine("Has acertado!!");
Console.WriteLine("Fin del juego!");
}
else
intentos--;
{
while (intentos > 0 && prueba != numSecreto)
{
intentos--;
Console.WriteLine("Has fallado! Prueba otra vez");
prueba = int.Parse(Console.ReadLine());
if (prueba == numSecreto)
{
Console.WriteLine("Has acertado!!");
Console.WriteLine("Fin del juego!");
}
if (intentos == 0)
{
Console.WriteLine("Te has quedado sin intentos");
Console.WriteLine("Fin del juego");
}
}
}
}
}
}

0 comments on commit 07e7d34

Please sign in to comment.