Commit ccb92ad4 authored by Pouya Kary's avatar Pouya Kary

new foundation, some bug fixes

parent f50e8378
<Properties GitUserInfo="UsingGIT">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="series/UI.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="series/Levels.cs">
<Files>
<File FileName="series/Program.cs" Line="1" Column="1" />
<File FileName="series/UI.cs" Line="107" Column="4" />
<File FileName="series/UI.cs" Line="1" Column="1" />
<File FileName="series/RunLevel.cs" Line="1" Column="1" />
<File FileName="series/Levels.cs" Line="1" Column="1" />
<File FileName="series/Levels.cs" Line="16" Column="4" />
<File FileName="series/ArrayTools.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
......
......@@ -3,6 +3,10 @@
namespace Series
{
/* ───────────────────────────────────────────────────────── *
* :::::::::: K A R Y S E R I E S L E V E L S :::::::::: *
* ───────────────────────────────────────────────────────── */
public class Levels
{
/// <summary>
......@@ -24,7 +28,7 @@ namespace Series
{ 100, 90, 80, 70, 60, 50, 40, 30, 20, 10 },
{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 10, 20, 30, 10, 20, 30, 10, 20, 30, 10 },
{ 1, 3, 7, 15, 35, 63, 127, 255, 511, 1023 },
{ 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023 },
{ 1, 3, 7, 12, 18, 26, 35, 45, 56, 69 },
{ 10, 20, 3, 15, 1000, 60, 16, 17, 18, 19 }
......
using System;
using NCalc;

using System;
using Kary.Foundation;
using Kary.Calculat;
namespace Series
{
/* ───────────────────────────────────────────────────── *
* :::::::::: K A R Y S E R I E S M A I N :::::::::: *
* ───────────────────────────────────────────────────── */
class MainClass
{
public static void Main (string[] args)
{
//
// TERMINATING THE PROCESS IF THE SCREEN SIZE IS TOO SHORT
//
string title_before_init = Terminal.Title;
if (Terminal.Width < 70) {
Terminal.PrintLn ("\n --> Screen size is too short. You need more then 70 column\n");
Terminal.Title = title_before_init;
Environment.Exit (exitCode:1);
}
//
// WELCOME AND INIT OF NCALC
//
UI.welcome ();
Expression load_lib_expression = new Expression ("2 * 3 + 1");
......@@ -16,8 +42,13 @@ namespace Series
UI.enter_to_continue ("press any key to start...", 0);
UI.intro_screen ();
//
// BODY
//
bool cont_1 = true;
int level = 1;
int level = 1;
while (cont_1) {
......@@ -31,8 +62,15 @@ namespace Series
UI.you_won_screen ();
cont_1 = false;
Terminal.Title = title_before_init;
}
}
//
// AND WE'RE ALL DONE
//
}
}
}
}
\ No newline at end of file
using System;
using NCalc;
using System.Diagnostics;
using Kary.Foundation;
using Kary.Calculat;
namespace Series
{
/* ───────────────────────────────────────────────────────────── *
* :::::::::: K A R Y S E R I E S R U N L E V E L :::::::::: *
* ───────────────────────────────────────────────────────────── */
public class RunLevel
{
/// <summary>
......@@ -40,15 +46,15 @@ namespace Series
}
Console.Clear ();
Console.WriteLine ("\n\n");
Terminal.Clean ();
Terminal.PrintLn ("\n\n");
//
// SHOWING THE LEVEL TO THE USER
//
UI.question ("Level " + level_number + " = " + ArrayTools.FloatArrayToString (level_array));
UI.question ("Level " + level_number + " = ⟨ " + ArrayTools.FloatArrayToString (level_array) + " ⟩");
//
// ASKING FOR FORMULA:
......@@ -67,7 +73,7 @@ namespace Series
// TESTING THE 10 FIRST INDEX
//
int[] test_results = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
object[] test_results = { null, null, null, null, null, null, null, null, null, null };
bool evaluation_problems = false;
......@@ -83,15 +89,16 @@ namespace Series
exp.Parameters ["p"] = 0;
}
int temp_result = 0;
object temp_result;
try {
temp_result = (int)exp.Evaluate ();
temp_result = exp.Evaluate ();
} catch {
temp_result = 0;
Debug.WriteLine (exp.ParsedExpression.ToString ());
evaluation_problems = true;
}
......@@ -112,7 +119,7 @@ namespace Series
for (int i = 0; i < 10; i++) {
if (test_results[i] != level_array[i]) {
if (test_results[i].ToString () != level_array[i].ToString ()) {
equal = false;
}
......@@ -126,17 +133,17 @@ namespace Series
} else {
Console.Clear ();
Terminal.Clean ();
UI.failed_profile (test_results, level_array);
UI.enter_to_continue ("try again...", 0);
Console.Clear ();
Terminal.Clean ();
}
} else {
UI.enter_to_continue ("Evaluation problems! Try again please...", 0);
Console.Clear ();
Terminal.Clean ();
}
......

using System;
using Panther.Text;
using Panther;
using Kary.Foundation;
using Kary.Text;
namespace Series
{
/* ------------------------------------- *
* :::::::::: U I C L A S S :::::::::: *
* ------------------------------------- */
/* ─────────────────────────────────────────────────────────────────── *
* :::::::::: K A R Y S E R I E S U I E L E M E N T S :::::::::: *
* ─────────────────────────────────────────────────────────────────── */
public class UI
{
......@@ -133,12 +134,12 @@ namespace Series
public static string input () {
Terminal.PrintLn(Utilities.Perpend("┌─────────────┬─────────────────────────────────────────────────┐\n│ KARY SERIES │::: I N P U T :::::::::::::::::::::::::::::::::::│\n├─────────────┴─────────────────────────────────────────────────┤\n│ │\n│ │\n│ │\n└───────────────────────────────────────────────────────────────┘", " "));
Terminal.PrintLn(Utilities.Perpend("┌─────────────┬─────────────────────────────────────────────────┐\n│ KARY SERIES │::: I N P U T :::::::::::::::::::::::::::::::::::│\n├─────────────┴─────────────────────────────────────────────────┤\n│ │\n│ Answer = │\n│ │\n└───────────────────────────────────────────────────────────────┘", " "));
Terminal.X += 5;
Terminal.X += 14;
Terminal.Y -= 3;
string the_input = Terminal.TextBox (61);
string the_input = Terminal.TextBox (52,"", true);
Terminal.Y++;
......@@ -160,7 +161,7 @@ namespace Series
// FAILED PROFILE
//
public static void failed_profile (int[] inps, int[] expects) {
public static void failed_profile (object[] inps, int[] expects) {
Terminal.PrintLn ("\n\n ┌─────────────┬─────────────────────────────────────────────────┐\n │ KARY SERIES │::: F A I L E D :::::::::::::::::::::::::::::::::│\n ├─────────────┴─────────────────────────────────────────────────┤\n │ │");
......@@ -172,7 +173,7 @@ namespace Series
for (int i = 1 ; i <= inps.Length ; i++) {
var roman_i = Panther.Text.Numerics.Roman (i).PadRight (4);
var roman_i = Numerics.Roman (i).PadRight (4);
UI.WriteLine (" " + roman_i + " │ " + inps [i - 1].ToString ().PadRight (24) + "│ " + expects[i - 1 ]);
......
// <autogenerated />
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = "")]
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/obj/x86/Debug/.NETFramework,Version=v4.0.AssemblyAttribute.cs
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/series.exe.mdb
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/series.exe
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/obj/x86/Debug/series.exe
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/obj/x86/Debug/series.exe.mdb
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/ArendelleNCalc.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Panther.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Antlr3.Runtime.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Calculat.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Leopard.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Kary.Leopard.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Kary.Calculat.dll
/Users/pmk/Dropbox/Document/Source Codes/KarySeries/series/bin/Debug/Kary.Foundation.dll
......@@ -30,11 +30,11 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="ArendelleNCalc, Version=1.3.8.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\Arcade IDE\Binary\ArendelleNCalc.dll</HintPath>
<Reference Include="Kary.Foundation">
<HintPath>..\..\Leopard\Leopard\obj\Release\Kary.Foundation.dll</HintPath>
</Reference>
<Reference Include="Panther">
<HintPath>..\..\Panther\Panther\bin\Release\Panther.dll</HintPath>
<Reference Include="Kary.Calculat">
<HintPath>..\..\..\..\..\Desktop\K\calculat-master 2\Binaries\Kary.Calculat.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment