Skip to content
This repository has been archived by the owner on Sep 5, 2018. It is now read-only.

Commit

Permalink
INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
pouyakary committed Apr 24, 2015
0 parents commit a8817c4
Show file tree
Hide file tree
Showing 50 changed files with 2,096 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Int/Int.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2D08D308-273E-42CA-B46B-039304DFA9DD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Int</RootNamespace>
<AssemblyName>Int</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Kary.Leopard">
<HintPath>..\..\Leopard\Leopard\bin\Release\Kary.Leopard.dll</HintPath>
</Reference>
<Reference Include="Kary.Calculat">
<HintPath>..\..\Calculat\Binaries\Kary.Calculat.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Interface\Intactus.Interface.cs" />
<Compile Include="Interface\Chart\Intactus.Interface.ColumnChart.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\Intactus\Kary.Intactus.csproj">
<Project>{197EF4D8-9842-4D2D-B4CA-9BF0F18D9E8E}</Project>
<Name>Kary.Intactus</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Interface\" />
<Folder Include="Interface\Chart\" />
</ItemGroup>
</Project>
132 changes: 132 additions & 0 deletions Int/Interface/Chart/Intactus.Interface.ColumnChart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@

//
// Intactus.Interface.ColumnChart.cs
//
// Created by Pouya Kary on 2015/4/23
// Copyright (c) 2015 Pouya Kary. All rights reserved.
//


using System;
using Kary.Leopard;
using Kary.Leopard.Text;
using Kary.Intactus;

namespace Int
{
public partial class Interface
{
public static void PrintColumnChart (string[] inputs, int io_counter)
{
//
// CREATING THE MAIN VIEW
//

int start_x = Terminal.X;
int start_y = Terminal.Y;


//
// GENERATING THE SUTABLE NUMBERS
//

double[] members = new double[inputs.Length];

for (int index_counter = 0; index_counter < inputs.Length; index_counter++) {

members [index_counter] = Calculate (inputs [index_counter]);

}


//
// GENERATING THE CHART
//

string column_chart = Charts.ColumnChart (members, 15);


//
// GENERATING STATICS
//

string statics = "\n";

int i = 1;

foreach (var mem in members) {

if (mem == double.MaxValue) {

statics += " " + Numerics.Roman (i).PadLeft (5) + "│ Infinity\n";

} else {

statics += " " + Numerics.Roman (i).PadLeft (5) + "" + mem + '\n';

}

i++;

}


//
// CONCATENATING THE STATICS TO THE CHART
//

column_chart = Utilities.Concatenate (column_chart, statics);


//
// PRINTING THE OUTPUT
//

string[] lines = column_chart.Split ('\n');
string prompt = "Out[" + Numerics.Roman (io_counter) + "]= ";

for (int index_counter = 0; index_counter < lines.Length; index_counter++) {

if ((double)index_counter == Math.Floor ((double)lines.Length / 2)) {

Terminal.Magenta();
Terminal.Print ("Out[" + Numerics.Roman (io_counter) + "]= ");
Terminal.Reset ();
Terminal.PrintLn (lines[index_counter]);

} else {

Terminal.PrintLn (
Utilities.Repeat (" ", prompt.Length) +
lines[index_counter]
);
}
}
}




/// <summary>
/// Represents a string reault of Calculat
/// </summary>
/// <param name="inputs">Inputs.</param>
private static double Calculate (string input) {

switch (input) {

case "False":
case "True":
case "Operation Failure":
return 0;

case "Infinity":
return double.MaxValue;

default:
return double.Parse (input);
}
}
}
}

Loading

0 comments on commit a8817c4

Please sign in to comment.