Szamkitalalo

This commit is contained in:
2022-02-09 12:25:51 +01:00
parent 9759455d2d
commit 1593958633
28 changed files with 253 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
{
"Version": 1,
"ProjectMap": {
"a6876a09-53d2-47af-a648-81bad791d19d": {
"ProjectGuid": "a6876a09-53d2-47af-a648-81bad791d19d",
"DisplayName": "c-sharp",
"ColorIndex": 0
},
"b1ffc5c5-05eb-454b-bc64-505e246ca686": {
"ProjectGuid": "b1ffc5c5-05eb-454b-bc64-505e246ca686",
"DisplayName": "Szamkitalalo",
"ColorIndex": 1
}
},
"NextColorIndex": 2
}

Binary file not shown.

BIN
.vs/c-sharp/v17/.suo Normal file

Binary file not shown.

6
Szamkitalalo/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

76
Szamkitalalo/Program.cs Normal file
View File

@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Szamkitalalo {
class Program {
static void Main(string[] args) {
Random random = new Random();
short pc_random = (short)random.Next(1, 100);
short user_random = 0;
short tipp_counter = 0;
bool isFelhasznalo = false;
Console.WriteLine("Játékos vagy gép tippel? Ha jatekos irj 1-et");
short valasztas = Convert.ToInt16(Console.ReadLine());
if(valasztas == 1) {
isFelhasznalo = true;
}
while (tipp_counter < 5) {
if (isFelhasznalo) {
while (tipp_counter < 5) {
tipp_counter++;
Console.WriteLine("Tippelj (1-100)");
short user_tipp = Convert.ToInt16(Console.ReadLine());
if (pc_random > user_tipp) {
Console.WriteLine("Tul kicsi a tipp");
} else if (pc_random < user_tipp) {
Console.WriteLine("Tul nagy a tipp");
} else if (pc_random == user_tipp) {
Console.WriteLine("Nyertel");
Console.WriteLine("PC tippje: {0}", pc_random);
break;
}
if(tipp_counter == 5) {
Console.WriteLine("PC tippje: {0}",pc_random);
}
}
} else {
Console.WriteLine("Irj be egy szamot (1-100)");
user_random = Convert.ToInt16(Console.ReadLine());
short rand_min = 1;
short rand_max = 100;
while (user_random != pc_random) {
tipp_counter++;
pc_random = (short)random.Next(rand_min, rand_max);
Console.WriteLine("PC tipp {0}", pc_random);
if (pc_random < user_random) {
Console.WriteLine("Tul kicsi a tipp");
rand_min += 10;
if(rand_min > user_random) {
rand_min = user_random;
}
} else if (pc_random > user_random) {
Console.WriteLine("Tul nagy a tipp");
rand_max -= 10;
if(rand_max < user_random) {
rand_max = user_random;
}
} else if (pc_random == user_random) {
Console.WriteLine("PC nyert");
Console.WriteLine("Felhasznalo tippje: {0}", user_random);
break;
}
}
}
}
Console.ReadKey();
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Szamkitalalo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Szamkitalalo")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b1ffc5c5-05eb-454b-bc64-505e246ca686")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1FFC5C5-05EB-454B-BC64-505E246CA686}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Szamkitalalo</RootNamespace>
<AssemblyName>Szamkitalalo</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@@ -0,0 +1 @@
7f4b213b428f4c013f19137338418ee1f5525793

View File

@@ -0,0 +1,7 @@
C:\dev\c#\c-sharp\Szamkitalalo\obj\Debug\Szamkitalalo.csproj.AssemblyReference.cache
C:\dev\c#\c-sharp\Szamkitalalo\obj\Debug\Szamkitalalo.csproj.CoreCompileInputs.cache
C:\dev\c#\c-sharp\Szamkitalalo\bin\Debug\Szamkitalalo.exe.config
C:\dev\c#\c-sharp\Szamkitalalo\bin\Debug\Szamkitalalo.exe
C:\dev\c#\c-sharp\Szamkitalalo\bin\Debug\Szamkitalalo.pdb
C:\dev\c#\c-sharp\Szamkitalalo\obj\Debug\Szamkitalalo.exe
C:\dev\c#\c-sharp\Szamkitalalo\obj\Debug\Szamkitalalo.pdb

Binary file not shown.

Binary file not shown.

View File

@@ -1,10 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.31911.196 VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c-sharp", "c-sharp\c-sharp.csproj", "{A6876A09-53D2-47AF-A648-81BAD791D19D}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "c-sharp", "c-sharp\c-sharp.csproj", "{A6876A09-53D2-47AF-A648-81BAD791D19D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Szamkitalalo", "Szamkitalalo\Szamkitalalo.csproj", "{B1FFC5C5-05EB-454B-BC64-505E246CA686}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{A6876A09-53D2-47AF-A648-81BAD791D19D}.Debug|Any CPU.Build.0 = Debug|Any CPU {A6876A09-53D2-47AF-A648-81BAD791D19D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6876A09-53D2-47AF-A648-81BAD791D19D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A6876A09-53D2-47AF-A648-81BAD791D19D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6876A09-53D2-47AF-A648-81BAD791D19D}.Release|Any CPU.Build.0 = Release|Any CPU {A6876A09-53D2-47AF-A648-81BAD791D19D}.Release|Any CPU.Build.0 = Release|Any CPU
{B1FFC5C5-05EB-454B-BC64-505E246CA686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1FFC5C5-05EB-454B-BC64-505E246CA686}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1FFC5C5-05EB-454B-BC64-505E246CA686}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1FFC5C5-05EB-454B-BC64-505E246CA686}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -10,6 +10,32 @@ namespace c_sharp
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
string folytatas = "igen";
string[] opciok = { "ko", "papir", "ollo" };
while (folytatas == "igen") {
Random random = new Random();
int pc_random = random.Next(0, 2);
string pc_valasztas = opciok[pc_random];
string user_valsztas = Console.ReadLine();
Console.WriteLine("PC: {0}",pc_valasztas);
if (pc_valasztas == "ko" && user_valsztas == "ko") { Console.WriteLine("Dontetlen"); }
else if (pc_valasztas == "ko" && user_valsztas == "papir") { Console.WriteLine("Vesztettel"); }
else if (pc_valasztas == "ko" && user_valsztas == "ollo") { Console.WriteLine("Nyertel"); }
else if (pc_valasztas == "papir" && user_valsztas == "ko") { Console.WriteLine("Vesztettel"); }
else if (pc_valasztas == "papir" && user_valsztas == "papir") { Console.WriteLine("Dontetlen"); }
else if (pc_valasztas == "papir" && user_valsztas == "ollo") { Console.WriteLine("Nyertel"); }
else if (pc_valasztas == "ollo" && user_valsztas == "ko") { Console.WriteLine("Nyertel"); }
else if (pc_valasztas == "ollo" && user_valsztas == "papir") { Console.WriteLine("Vesztettel"); }
else if (pc_valasztas == "ollo" && user_valsztas == "ollo") { Console.WriteLine("Dontetlen"); }
else { Console.WriteLine("Hiba"); }
Console.WriteLine("Akarsz meg jatszani? (igen/nem)");
folytatas = Console.ReadLine();
}
} }
} }
} }

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

View File

@@ -0,0 +1 @@
7f4b213b428f4c013f19137338418ee1f5525793

View File

@@ -0,0 +1,7 @@
C:\dev\c#\c-sharp\c-sharp\bin\Debug\c-sharp.exe.config
C:\dev\c#\c-sharp\c-sharp\bin\Debug\c-sharp.exe
C:\dev\c#\c-sharp\c-sharp\bin\Debug\c-sharp.pdb
C:\dev\c#\c-sharp\c-sharp\obj\Debug\c-sharp.csproj.AssemblyReference.cache
C:\dev\c#\c-sharp\c-sharp\obj\Debug\c-sharp.csproj.CoreCompileInputs.cache
C:\dev\c#\c-sharp\c-sharp\obj\Debug\c-sharp.exe
C:\dev\c#\c-sharp\c-sharp\obj\Debug\c-sharp.pdb

Binary file not shown.

Binary file not shown.