unbloatation

This commit is contained in:
anon 2022-11-21 22:10:15 +01:00
parent 3c6307762b
commit 462962efca
42 changed files with 7 additions and 1085 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +0,0 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\Program.cs",
"PreviewInSolutionExplorer": false
}

Binary file not shown.

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

Binary file not shown.

View File

@ -1,23 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Chess/1.0.0": {
"runtime": {
"Chess.dll": {}
}
}
}
},
"libraries": {
"Chess/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +0,0 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

Binary file not shown.

View File

@ -1,66 +0,0 @@
{
"format": 1,
"restore": {
"/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj": {}
},
"projects": {
"/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj",
"projectName": "Chess",
"projectPath": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj",
"packagesPath": "/home/jacob/.nuget/packages/",
"outputPath": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/jacob/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[6.0.0, 6.0.0]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.100/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/jacob/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/jacob/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/jacob/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -1,22 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Chess")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Chess")]
[assembly: System.Reflection.AssemblyTitleAttribute("Chess")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +0,0 @@
e0e0edb49f36c9ab138f7409cfb286ad9d71eca2

View File

@ -1,10 +0,0 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Chess
build_property.ProjectDir = /home/jacob/Desktop/minecraft mod/C#/chess/Chess/

View File

@ -1,8 +0,0 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -1 +0,0 @@
5bbc1321a055d64202fa924c6aedd72a553ab364

View File

@ -1,45 +0,0 @@
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/Chess
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/Chess.deps.json
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/Chess.runtimeconfig.json
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/Chess.dll
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/ref/Chess.dll
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/bin/Debug/net6.0/Chess.pdb
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.csproj.AssemblyReference.cache
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.GeneratedMSBuildEditorConfig.editorconfig
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfoInputs.cache
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfo.cs
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.csproj.CoreCompileInputs.cache
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.dll
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/ref/Chess.dll
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.pdb
/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/Debug/net6.0/Chess.genruntimeconfig.cache
/media/eriks/ARCH_202109/chess/Chess/bin/Debug/net6.0/Chess
/media/eriks/ARCH_202109/chess/Chess/bin/Debug/net6.0/Chess.deps.json
/media/eriks/ARCH_202109/chess/Chess/bin/Debug/net6.0/Chess.runtimeconfig.json
/media/eriks/ARCH_202109/chess/Chess/bin/Debug/net6.0/Chess.dll
/media/eriks/ARCH_202109/chess/Chess/bin/Debug/net6.0/Chess.pdb
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.csproj.AssemblyReference.cache
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.GeneratedMSBuildEditorConfig.editorconfig
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfoInputs.cache
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfo.cs
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.csproj.CoreCompileInputs.cache
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.dll
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/refint/Chess.dll
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.pdb
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/Chess.genruntimeconfig.cache
/media/eriks/ARCH_202109/chess/Chess/obj/Debug/net6.0/ref/Chess.dll
/home/eriks/Documents/chess/Chess/bin/Debug/net6.0/Chess
/home/eriks/Documents/chess/Chess/bin/Debug/net6.0/Chess.deps.json
/home/eriks/Documents/chess/Chess/bin/Debug/net6.0/Chess.runtimeconfig.json
/home/eriks/Documents/chess/Chess/bin/Debug/net6.0/Chess.dll
/home/eriks/Documents/chess/Chess/bin/Debug/net6.0/Chess.pdb
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.csproj.AssemblyReference.cache
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.GeneratedMSBuildEditorConfig.editorconfig
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfoInputs.cache
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.AssemblyInfo.cs
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.csproj.CoreCompileInputs.cache
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.dll
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/refint/Chess.dll
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.pdb
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/Chess.genruntimeconfig.cache
/home/eriks/Documents/chess/Chess/obj/Debug/net6.0/ref/Chess.dll

Binary file not shown.

View File

@ -1 +0,0 @@
1ca55350402c4bcb916ac2bb9eb4b643e8a1550e

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +0,0 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -1,23 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Chess")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Chess")]
[assembly: System.Reflection.AssemblyTitleAttribute("Chess")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +0,0 @@
2c1ff3e7c79f9db5dbe0bd4e767b021e532bafdd

View File

@ -1,10 +0,0 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.PublishSingleFile =
build_property.IncludeAllContentForSelfExtract =
build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows
build_property.RootNamespace = Chess
build_property.ProjectDir = G:\chess\Chess\

View File

@ -1,71 +0,0 @@
{
"version": 3,
"targets": {
"net6.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net6.0": []
},
"packageFolders": {
"/home/jacob/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj",
"projectName": "Chess",
"projectPath": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj",
"packagesPath": "/home/jacob/.nuget/packages/",
"outputPath": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/jacob/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"downloadDependencies": [
{
"name": "Microsoft.AspNetCore.App.Ref",
"version": "[6.0.0, 6.0.0]"
}
],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.100/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -1,10 +0,0 @@
{
"version": 2,
"dgSpecHash": "qdHJvo6eXXNDYHcmvRJoQB5N+Ye1AbOTeJN0zsQWX5Rzcx5+7mquOib8kvyo0JN2xfH7LB8rINwyBq39qOoFEw==",
"success": true,
"projectFilePath": "/home/jacob/Desktop/minecraft mod/C#/chess/Chess/Chess.csproj",
"expectedPackageFiles": [
"/home/jacob/.nuget/packages/microsoft.aspnetcore.app.ref/6.0.0/microsoft.aspnetcore.app.ref.6.0.0.nupkg.sha512"
],
"logs": []
}

545
Chess/ű
View File

@ -1,545 +0,0 @@
using System;
using System.Collections.Generic;
/*-----------------------------------------Megjegyzések--------------------------------------------\\
| >az elnevezések direkt ékezet mentes szavak, ezért érződnek sutának
\\-------------------------------------------------------------------------------------------------*/
/*--------------------------------------------Todos------------------------------------------------\\
| >rájönni a dotnet cli-vel, hogy lehet több fájlban dolgozni
| >horda
| -nevek:
| >"játékmód"
| >"fehér"
| >a klasszikus felállítás algoritmizálása
\\-------------------------------------------------------------------------------------------------*/
namespace Hazi{
#region progi
//###########################
// ¤¤¤ Execution Entry ¤¤¤
//###########################
class Program{
static Random r = new Random();
static void Main(string[] args){
Asztal tabla = new Asztal(Jatekmod.klasszikus);
while(true){
tabla.print();
tabla.mozgat();
}
}
}
#endregion
#region enums\
//I^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
//I _____ \
//I | ___| \
//I | |__ _ __ _ _ _ __ ___ ___ \
//I | __| '_ \| | | | '_ ` _ \/ __| \
//I | |__| | | | |_| | | | | | \__ \ \
//I \____/_| |_|\__,_|_| |_| |_|___/ \
//I..................................I
public enum MozgatErrno{
FAIN,
NULL_FIGURA,
NULL_ASZTAL,
SZEGELVE,
BLOKKOLVA,
TILOS,
NEM_RUBLIKA,
ROSSZ_SZIN
}
public enum Jatekmod{
klasszikus,
horda
}
public enum Szin{
FEKETE = -1,
FEHER = 1
}
public enum Helyszin{
FEKETE,
WHITE,
SEMMILYEN
}
#endregion
public class HelyInfo{
public uint x;
public uint y;
public Asztal asztal;
public HelyInfo(){}
public HelyInfo(uint _x, uint _y, Asztal _asztal){
this.x = _x;
this.y = _y;
this.asztal = _asztal;
}
}
#region Figura
//I^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
//I ______ _ \
//I | ___(_) \
//I | |_ _ __ _ _ _ _ __ __ _ \
//I | _| | |/ _` | | | | '__/ _` | \
//I | | | | (_| | |_| | | | (_| | \
//I \_| |_|\__, |\__,_|_| \__,_| \
//I __/ | \
//I |___/ \
//I.................................I
public class Figura{
//------------------------
// Belső változók
//------------------------
public static MozgatErrno mozgat_errno = MozgatErrno.FAIN;
public bool vajon_szegelve;
public bool vajon_asztalon;
protected Szin szin;
protected HelyInfo helyinfo;
protected uint meritum;
protected char jel;
// ### Set-Get ###
public uint X{
get{
if(!this.vajon_asztalon){ throw new NullReferenceException(""); }
return this.helyinfo.x;
}
set{
if(Asztal.TERMET < value) throw new ArgumentOutOfRangeException("");
this.helyinfo.x = value;
}
}
public uint Y{
get{
if(!this.vajon_asztalon){ throw new NullReferenceException(""); }
return this.helyinfo.y;
}
set{
if (Asztal.TERMET < value) throw new ArgumentOutOfRangeException("");
this.helyinfo.y = value;
}
}
public Asztal Asztal{
get{ return this.helyinfo.asztal; }
set{ this.helyinfo.asztal = value; }
}
public uint Meritum{
get{ return this.meritum; }
}
public char Jel{
get{ return this.jel; }
}
public Szin Szin{
get{ return this.szin; }
}
//------------------------
// Belső eljárások
//------------------------
// ### Speciális ###
// Constructor-ok
public Figura(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false){
this.szin = _szin;
this.helyinfo = new HelyInfo();
if(_helyinfo == null){
this.vajon_asztalon = false;
this.vajon_szegelve = false;
}else{
if(_helyinfo.asztal == null){ throw new NullReferenceException(""); }
this.X = _helyinfo.x;
this.Y = _helyinfo.y;
this.Asztal = _helyinfo.asztal;
this.vajon_asztalon = true;
this.vajon_szegelve = _vajon_szegelve;
}
}
// ### Állapot befolyásolók ###
public bool vajon_mozgat(){
if(!this.vajon_asztalon){ mozgat_errno = MozgatErrno.NULL_ASZTAL; return false; }
if(this.vajon_szegelve){ mozgat_errno = MozgatErrno.SZEGELVE; return false; }
return true;
}
public virtual bool mozgat(uint _x, uint _y){ return false; }
protected void rak(uint _x, uint _y){
this.Asztal[this.X, this.Y] = null;
this.X = _x;
this.Y = _y;
this.Asztal[_x, _y] = this;
mozgat_errno = MozgatErrno.FAIN;
}
// ### Állapot ellenőrzők ###
}
// ___ _
// / __|_ _ ___ _ __ _ _ ___ _ __ ___| |__
//| (_ | || / -_) ' \| '_/ -_) ' \/ -_) / /
// \___|\_, \___|_|_|_|_| \___|_|_|_\___|_\_\
// |__/
class Gyalog : Figura{
private bool vajon_kezdett;
public Gyalog(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false, bool _vajon_kezdett = false)
: base(_szin, _helyinfo, _vajon_szegelve){
this.vajon_kezdett = _vajon_kezdett;
this.meritum = 1;
if(this.szin == Szin.FEKETE){
this.jel = '♟';
}else{
this.jel = '♙';
}
}
public override bool mozgat(uint _x, uint _y){
// Simpla
if(_y == (this.Y + (int)this.szin)){
if(this.Asztal[this.X, _y] != null){ mozgat_errno = MozgatErrno.BLOKKOLVA; return false; }
}else
// Dupla
if( !this.vajon_kezdett && _y == (this.Y + (int)this.szin * 2) ){
if(this.Asztal[this.X, (uint)(this.Y + (int)this.szin)] != null || this.Asztal[this.X, _y] != null){
mozgat_errno = MozgatErrno.BLOKKOLVA; return false;
}
}else
// Ütés
if(false){
}else
// En passant
if(false){
}else
// Illegális
{
mozgat_errno = MozgatErrno.TILOS;
return false;
}
this.rak(_x, _y);
this.vajon_kezdett = true;
return true;
}
}
class Paci : Figura{
public Paci(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false)
: base(_szin, _helyinfo, _vajon_szegelve){
this.meritum = 3;
if(this.szin == Szin.FEKETE){
this.jel = '♞';
}else{
this.jel = '♘';
}
}
}
class RohamOsztagos : Figura{
private Helyszin helyszin;
public RohamOsztagos(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false, Helyszin _helyszin = Helyszin.SEMMILYEN)
: base(_szin, _helyinfo, _vajon_szegelve){
this.helyszin = _helyszin;
this.meritum = 3;
if(this.szin == Szin.FEKETE){
this.jel = '♝';
}else{
this.jel = '♗';
}
}
}
class Torony : Figura{
private bool vajon_kezdett;
public Torony(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false, bool _vajon_kezdett = false)
: base(_szin, _helyinfo, _vajon_szegelve){
this.vajon_kezdett = _vajon_kezdett;
this.meritum = 1;
if(this.szin == Szin.FEKETE){
this.jel = '♜';
}else{
this.jel = '♖';
}
}
public override bool mozgat(uint _x, uint _y){
if(this.X == _x){
int h = Math.sign(this.Y - _y)
for(int i = this.Y; i != (_y + h); i = i + h){
if(this.Asztal[_x, _y] != null){ mozgat_errno = MozgatErrno.BLOKKOLVA; return false; }
}
if(this.Asztal[_x, _y] != null){
this.Asztal.addHalottak(this.Asztal[_x, _y]);
}
}else
// Illegális
{
mozgat_errno = MozgatErrno.TILOS;
return false;
}
this.rak(_x, _y);
this.vajon_kezdett = true;
return true;
}
}
class Parancsnok : Figura{
public Parancsnok(Szin _szin, HelyInfo _helyinfo,
bool _vajon_szegelve = false)
: base(_szin, _helyinfo, _vajon_szegelve){
this.meritum = 9;
if(this.szin == Szin.FEKETE){
this.jel = '♛';
}else{
this.jel = '♕';
}
}
}
class Fejedelem : Figura{
private bool vajon_kezdett;
private bool sakk;
public Fejedelem(Szin _szin, HelyInfo _helyinfo = null,
bool _vajon_szegelve = false, bool _vajon_kezdett = false, bool _sakk = false)
: base(_szin, _helyinfo, _vajon_szegelve){
this.vajon_kezdett = _vajon_kezdett;
this.sakk = _sakk;
this.meritum = 10;
if(this.szin == Szin.FEKETE){
this.jel = '♚';
}else{
this.jel = '♔';
}
}
}
#endregion
#region Asztal\
//I^^^^^^^^^^^^^^^^^^^^^^^^^^^^\
//I ___ _ _ \
//I / _ \ | | | | \
//I / /_\ \___ ___| |_ __ _| | \
//I | _ / __|_ / __/ _` | | \
//I | | | \__ \/ /| || (_| | | \
//I \_| |_/___/___|\__\__,_|_| \
//I............................I
public class Asztal{
//------------------------
// Belső változók
//------------------------
public const uint TERMET = 8;
private const string VKOCKA_ELEM = "+---";
private const string HKOCKA_ELEM = "| ";
private const string VKOCKA_DUGASZ = "+";
private const string HKOCKA_DUGASZ = "|";
private Jatekmod jatekmod;
private Figura[,] rublika = new Figura[TERMET, TERMET];
private List<Figura> halottak = new List<Figura>();
private Szin mozgatgat = Szin.FEHER;
// ### Set-Get ###
public Jatekmod Jatekmod{
get{ return this.jatekmod; }
set{ this.jatekmod = value; }
}
public Figura this[uint _x, uint _y]{
get {
if(_x > TERMET || _y > TERMET){ throw new ArgumentOutOfRangeException(""); }
return rublika[_x-1, _y-1];
}
set {
if(_x > TERMET || _y > TERMET || _x == 0 || _y == 0) throw new ArgumentOutOfRangeException("");
rublika[_x-1, _y-1] = value;
}
}
public void addHalottak(Figura figura){
this.halottak.Add(figura);
}
public void clearHalottak(){
this.halottak.Clear();
}
//------------------------
// Belső eljárások
//------------------------
// ### Speciális ###
// Constructor-ok
public Asztal(){}
public Asztal(Jatekmod _jatekmod){
this.jatekmod = _jatekmod;
if(this.jatekmod == Jatekmod.klasszikus){
for(uint i = 1; i <= TERMET; i++){
this[i, 2] = new Gyalog(Szin.FEHER, new HelyInfo(i, 2, this));
this[i, 7] = new Gyalog(Szin.FEKETE, new HelyInfo(i, 7, this));
}
this[1, 1] = new Torony(Szin.FEHER, new HelyInfo(1, 1, this));
this[8, 1] = new Torony(Szin.FEHER, new HelyInfo(8, 1, this));
this[1, 8] = new Torony(Szin.FEKETE, new HelyInfo(1, 8, this));
this[8, 8] = new Torony(Szin.FEKETE, new HelyInfo(8, 8, this));
this[2, 1] = new Paci(Szin.FEHER, new HelyInfo(2, 1, this));
this[7, 1] = new Paci(Szin.FEHER, new HelyInfo(7, 1, this));
this[2, 8] = new Paci(Szin.FEKETE, new HelyInfo(2, 8, this));
this[7, 8] = new Paci(Szin.FEKETE, new HelyInfo(7, 8, this));
this[3, 1] = new RohamOsztagos(Szin.FEHER, new HelyInfo(3, 1, this));
this[6, 1] = new RohamOsztagos(Szin.FEHER, new HelyInfo(6, 1, this));
this[3, 8] = new RohamOsztagos(Szin.FEKETE, new HelyInfo(3, 8, this));
this[6, 8] = new RohamOsztagos(Szin.FEKETE, new HelyInfo(6, 8, this));
this[4, 1] = new Parancsnok(Szin.FEHER, new HelyInfo(4, 1, this));
this[4, 8] = new Parancsnok(Szin.FEKETE, new HelyInfo(5, 8, this));
this[5, 1] = new Fejedelem(Szin.FEHER, new HelyInfo(5, 1, this));
this[5, 8] = new Fejedelem(Szin.FEKETE, new HelyInfo(4, 8, this));
}
}
// ### Állapot befolyásolók ###
private bool _mozgat(uint _x1, uint _y1, uint _x2, uint _y2){
// -ből határon belül?
if(_x1 > TERMET || _y1 > TERMET || _x1 == 0 || _y1 == 0){
Figura.mozgat_errno = MozgatErrno.NEM_RUBLIKA; return false;
}
// létező figura?
if(this[_x1, _y1] == null){ Figura.mozgat_errno = MozgatErrno.NULL_FIGURA; return false; }
// jó szin?
if(this[_x1, _y1].Szin != this.mozgatgat){ Figura.mozgat_errno = MozgatErrno.ROSSZ_SZIN; return false; }
// -be határon belül?
if(_x2 > TERMET || _y2 > TERMET || _x2 == 0 || _y2 == 0){
Figura.mozgat_errno = MozgatErrno.NEM_RUBLIKA; return false;
}
// mozoghat?
if(!this[_x1, _y1].vajon_mozgat()){ return false; }
return this[_x1, _y1].mozgat(_x2, _y2);
}
public void mozgat(){
Console.Write(": ");
INPUT:
string l = Console.ReadLine();
string[] k = l.Split("->");
foreach(var i in k){
if(i.Length < 2){ goto INPUT; }
}
uint x1, y1, x2, y2;
x1 = (uint)(k[0][0] - 96);
x2 = (uint)(k[1][0] - 96);
y1 = (uint)(k[0][1] - 48);
y2 = (uint)(k[1][1] - 48);
Console.WriteLine("{0}, {1}; {2}, {3}", x1, y1, x2, y2);
if(this._mozgat(x1, y1, x2, y2)){
if(this.mozgatgat == Szin.FEHER){
this.mozgatgat = Szin.FEKETE;
}else{
this.mozgatgat = Szin.FEHER;
}
}
}
// ### Állapot ellenőrzők ###
public void print(){
Console.WriteLine("\n\n");
// --- Tábla és bábúk ---
for(uint i = Asztal.TERMET; i >= 1; i--){
Console.Write(" ");
for(uint h = 1; h <= Asztal.TERMET; h++){
Console.Write(Asztal.VKOCKA_ELEM);
}
Console.WriteLine(Asztal.VKOCKA_DUGASZ);
Console.Write(" " + i + " ");
for(uint h = 1; h <= Asztal.TERMET; h++){
Console.Write(Asztal.HKOCKA_ELEM);
if(this[h, i] != null){
Console.Write(this[h, i].Jel);
}else{
Console.Write(' ');
}
Console.Write(' ');
}
Console.WriteLine(Asztal.HKOCKA_DUGASZ);
}
Console.Write(" ");
for(uint h = 1; h <= Asztal.TERMET; h++){
Console.Write(Asztal.VKOCKA_ELEM);
}
Console.WriteLine(Asztal.VKOCKA_DUGASZ);
Console.Write(" ");
for(uint i = 0; i < Asztal.TERMET; i++){
Console.Write(" " + (char)('a'+i) + " " );
}
Console.WriteLine();
// --- Leütött bábúk ---
Console.Write("\x1b[1mLeütött bábúk: \x1b[0m");
foreach(var i in this.halottak){
Console.Write(" " + i.Jel + ',');
}
Console.WriteLine();
// --- Lépés állapot ---
Console.Write("\x1b[1mSoron következő játékos: \x1b[0m");
if(this.mozgatgat == Szin.FEHER){
Console.Write("□ ");
}else{
Console.Write("■ ");
}
Console.WriteLine("\n\x1b[1mUtolsó lépés legalitása: \x1b[0m" + Figura.mozgat_errno);
}
}
#endregion
}

View File

@ -1,9 +1,14 @@
.PHONY: main clean
SRCD:=src/
SRC:=Program.cs
SRC:=$(addprefix ${SRCD},${SRC})
OUTPUT:=chess.out
main:
dotnet build Chess
mcs ${SRC} -o ${OUTPUT}
run:
dotnet run --project Chess
mono ${OUTPUT}
clean:

View File

@ -1,113 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DavidHazi
{
enum szinek
{
BLACK,
EMBER
}
enum helyszinek
{
FEKETE,
WHITE,
VUOTA
}
class Babuk
{
private szinek szin;
private int x;
private int y;
public bool isPinned;
private int value;
public bool onBoard;
public char c;
public Babuk(szinek szin, int x, int y , bool isPinned = false, bool onBoard = false)
{
this.szin = szin;
X = x;
Y = y;
this.isPinned = isPinned;
this.onBoard = onBoard;
}
public int X
{
get
{
return x;
}
set
{
if (x < 1 || x > 8) throw new Exception("ez szar lesz öcsi");
x = value;
}
}
public int Y
{
get
{
return y;
}
set
{
if (y < 1 || y > 8) throw new Exception("ez szar lesz öcsi");
y = value;
}
}
}
class Pawn : Babuk
{
private bool firstMove;
public Pawn(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false, bool firstMove = false) : base(szin, x, y, isPinned, onBoard = false)
{
this.firstMove = firstMove;
c = 'P';
}
}
class Rook : Babuk
{
private bool firstMove;
public Rook(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false, bool firstMove = false) : base(szin, x, y, isPinned, onBoard = false)
{
this.firstMove = firstMove;
c = 'R';
}
}
class Queen : Babuk
{
public Queen(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false) : base(szin, x, y, isPinned, onBoard = false)
{
c = 'Q';
}
}
class Bishop : Babuk
{
private helyszinek helyszin;
public Bishop(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false, helyszinek helyszinek = helyszinek.VUOTA) : base(szin, x, y, isPinned, onBoard = false)
{
this.helyszin = helyszinek;
c = 'B';
}
}
class Knight : Babuk
{
public Knight(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false) : base(szin, x, y, isPinned, onBoard = false)
{
c = 'k';
}
}
class King : Babuk
{
private bool firstMove;
private bool sakk;
public King(szinek szin, int x, int y, bool isPinned = false, bool onBoard = false, bool firstMove = false,bool sakk = false) : base(szin, x, y, isPinned, onBoard = false)
{
this.firstMove = firstMove;
this.sakk = sakk;
c = 'K';
}
}
}

View File

@ -1,15 +0,0 @@
using System;
namespace DavidHazi
{
class Program
{
static void Main(string[] args)
{
Tabla tabla = new Tabla(jatekmod.classical);
tabla.print();
Console.ReadLine();
}
}
}

View File

@ -1,67 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DavidHazi
{
enum jatekmod
{
classical,
horde
}
class Tabla
{
private static string sor = "+--+--+--+--+--+--+--+--+";
public const int szelesseg = 8;
private Babuk[,] mezo = new Babuk[8,8];
private List<Babuk> dead = new List<Babuk>();
public Babuk getMezo(int x,int y)
{
if (x > szelesseg || y > szelesseg || x < 1 || y < 1) throw new Exception("nem megfelelő koordináták");
return mezo[x-1, y-1];
}
public void setMezo( int x, int y, Babuk babu = null)
{
if (x > szelesseg || y > szelesseg || x < 1 || y < 1) throw new Exception("nem megfelelő koordináták");
mezo[x-1, y-1] = babu;
}
public Tabla()
{
}
public Tabla(jatekmod jatekmod)
{
if(jatekmod == jatekmod.classical)
{
for (int i = 1; i <= szelesseg; i++)
{
setMezo(i, 2, new Pawn(szinek.EMBER,i,2));
setMezo(i, 7, new Pawn(szinek.BLACK,i,7));
}
}
}
public void print()
{
for (int i = 1; i < 8; i++) {
Console.WriteLine(sor)
;for (int h = 1; h < 8; h++) {
Console.Write("| ")
; if (getMezo(i, h) != null)
{
Console.Write(getMezo(i, h).c)
;
}
else
{
Console.Write(' ')
;
}
}
Console.WriteLine("|");
}
Console.WriteLine(sor)
;
}
}
}