statics data
154
data/ConvertFromDB_Euler.linq
Normal file
93
data/ConvertFromDB_Programs.linq
Normal file
@ -0,0 +1,93 @@
|
||||
<Query Kind="Program">
|
||||
<Namespace>System.CodeDom.Compiler</Namespace>
|
||||
<Namespace>System.CodeDom</Namespace>
|
||||
</Query>
|
||||
|
||||
Encoding ENC = new UTF8Encoding(false);
|
||||
|
||||
void Main()
|
||||
{
|
||||
Do(1, "All in One", "All in One", 1439, "Tool", 1, 1, 1, "German", "Delphi", "A little \"swiss army knife\" programm with over 100 different functionalities", "2008-11-26", "direkt", "", "", "", 0, "", -1);
|
||||
Do(2, "Beepster", "Beepster", 1960, "Hoax", 0, 1, 1, "English", "Delphi", "Annoy your teachers/freinds with a very high pitched sound, even without external speakers.", "2008-06-04", "direkt", "", "", "", 0, "", -1);
|
||||
Do(3, "Blitzer", "Blitzer", 1869, "Hoax", 0, 1, 1, "English", "Delphi", "Hoax you teachers/friends with flashing lights on your monitor.", "2008-05-05", "direkt", "", "", "", 0, "", -1);
|
||||
Do(4, "Deal or no Deal", "Deal or no Deal", 1279, "Game", 0, 1, 1, "German", "Delphi", "A digital version of the same-named german tv-show game.", "2008-10-08", "direkt", "", "", "", 0, "", -1);
|
||||
Do(5, "exeExtract", "exe Extract", 1818, "Tool", 0, 1, 1, "English", "Delphi", "A simple tool to copy all files of a specific extension from a folder.", "2008-03-26", "direkt", "", "", "", 0, "", -1);
|
||||
Do(6, "Graveyard of Numbers", "G. o. N.", 1221, "Tool", 0, 1, 1, "German", "Delphi", "A little tool to continuously rename files.", "2008-10-01", "direkt", "", "", "", 0, "", -1);
|
||||
Do(7, "LightShow", "LightShow", 1888, "Hoax", 0, 1, 1, "German", "Delphi", "Turn you keyboard-LED\"s into a little lightshow", "2008-10-12", "direkt", "", "", "", 0, "", -1);
|
||||
//Do(8, "Penner-Bot", "Penner Bot", 3722, "Bot", 0, 0, 0, "German", "C++", "Cheat in the browsergame \"Pennergame\" and get a lot of Bottles free.", "2008-10-22", "direkt", "", "", "", 0, "", -1);
|
||||
Do(9, "Ziegenproblem", "Ziegenproblem", 2257, "Mathematics", 0, 1, 1, "German", "Delphi", "Simulate the popular Monty Hall problem (ger: Ziegenproblem) with this program for yourself.", "2008-04-10", "direkt", "", "", "", 0, "", -1);
|
||||
//Do(10, "Niripsa", "Niripsa", 1604, "Game", 1, 1, 0, "German", "Delphi", "A clone of the game \"Aspirin\" in space.", "2008-11-19", "direkt", "", "", "", 0, "", -1);
|
||||
Do(11, "NedSchend", "Nedschend", 1563, "Hoax", 1, 1, 1, "German", "Delphi", "Send anonymous messages over the Windows Messenger service to other pc\"s in your LAN", "2009-02-11", "direkt", "", "", "", 0, "", -1);
|
||||
Do(12, "Sieb des Eratosthenes", "Sieb des E.", 1671, "Mathematics", 1, 1, 1, "German", "Delphi", "Visualize the prime number calculation with the Sieve of Erastothenes algorithm.", "2009-01-22", "direkt", "", "", "", 0, "", -1);
|
||||
Do(13, "Logistixx", "Logistixx", 1599, "Mathematics", 1, 1, 1, "German", "Delphi", "Find the trick to escape the seemingly escape-proof maze.", "2008-12-20", "direkt", "", "", "", 0, "", -1);
|
||||
Do(14, "H2O", "H²O", 1953, "Game", 2, 1, 1, "English", "Delphi", "Try creating the biggest chain reaction and see yourself climb up in the global leaderboard.", "2009-01-24", "direkt", "", "", "", 0, "H²O", 2);
|
||||
Do(15, "LAN-Control", "LAN-Control", 1781, "Network administration", 1, 1, 1, "German", "Delphi", "Controll essential features of an other computer over the LAN", "2011-07-05", "direkt", "", "", "", 0, "LAN-Control", -1);
|
||||
Do(16, "Smart Directory Lister", "SDL", 1064, "Tool", 2, 1, 1, "German", "Delphi", "List all files in a folder that match a specific pattern and export them in plaintext.", "2010-01-12", "direkt", "", "", "", 0, "", -1);
|
||||
//Do(17, "Wikipedia - The Game", "Wiki Game", 318, "Game", 1, 1, 0, "German", "Delphi", "Expand your knowledge while you read trough wikipedia articles to find the way to your target.", "2010-05-29", "direkt", "", "", "", 0, "WTG", 3);
|
||||
//Do(18, "ClipCorn", "ClipCorn", 126, "Tool", 3, 0, 0, "German", "Delphi", "Collect and Organize all your movies central and portable in a database.", "2010-06-26", "direkt", "", "", "", 0, "ClipCorn", -1);
|
||||
Do(19, "Dynamic Link Fighters", "DLF", 1296, "Game", 1, 1, 1, "English|German", "Delphi", "Program your own KI and let it fight against others in a brutal deathmatch.", "2010-12-04", "direkt", "", "", "", 0, "DLF", -1);
|
||||
Do(20, "TicTacToe", "Tic Tac Toe", 1422, "Game", 1, 1, 1, "English", "Delphi", "The classical Tic-Tac-Toe, complete with perfect KI and Sourcecode.", "2011-01-19", "direkt", "", "", "", 0, "", -1);
|
||||
Do(21, "Keygen Dancer", "Keygen Dancer", 665, "Gadget", 2, 1, 1, "English", "Delphi", "40 of the best keygen themes together with a funny little keygen dance animation.", "2010-03-16", "", "", "", "", 0, "", -1);
|
||||
Do(22, "Infinity Tournament", "Inf. Tournament", 1258, "Game", 4, 1, 1, "English", "Java", "A never ending Tower Defense where you fight against your own score.", "2012-04-14", "direkt", "", "", "", 1, "InfinityTournament", 4);
|
||||
Do(23, "jCircuits", "jCircuits", 1411, "Simulation", 4, 1, 1, "English", "Java", "A fully featured logical circuit simulator with many prebuild components", "2011-12-16", "direkt", "http://sourceforge.net/projects/jcircuits/", "", "", 0, "", -1);
|
||||
Do(24, "Borderline Defense", "Borderline Defense", 1042, "Game", 4, 1, 1, "English", "Java", "A improved Space-Invaders clone - programmed from the Java-AG, Oken.", "2012-05-24", "direkt", "", "http://borderlinedefense.99k.org/", "", 1, "", 5);
|
||||
Do(25, "absCanvas", "absCanvas", 1442, "Engine", 3, 1, 1, "English", "Java", "A powerful 2D Tiled-Game-Engine for java. Completely in canvas and with network support.", "2012-05-28", "direkt", "", "", "", 0, "absCanvas", -1);
|
||||
Do(26, "Crystal Grid", "Crystal Grid", 1032, "Game", 4, 1, 1, "English", "Java", "A challenging, tactical mini-game in blueprint-style.", "2013-01-03", "direkt", "", "", "", 1, "CrystalGrid", 6);
|
||||
Do(28, "jClipCorn", "jClipCorn", 432, "Tool", 4, 1, 1, "English|German", "Java", "Organize your movies and series on an external hard drive.", "2012-10-28", "https://github.com/Mikescher/jClipCorn/releases", "", "", "https://github.com/Mikescher/jClipCorn/wiki", 0, "jClipCorn", -1);
|
||||
Do(29, "BefunZ", "BefunZ", 1005, "Interpreter", 3, 1, 1, "English", "C#", "A Befunge-93 Interpreter compatible with Befunge-98 dimensions.", "2013-05-03", "direkt", "", "", "", 0, "", -1);
|
||||
Do(30, "Serpilicum", "Serpilicum", 846, "Game", 3, 1, 1, "English", "C++", "A crazy little Snake with an \"Console\" Style", "2013-07-08", "direkt", "", "", "https://github.com/Mikescher/Serpilicum", 0, "", -1);
|
||||
Do(32, "SuperBitBros", "SuperBitBros", 870, "Game", 4, 1, 1, "English", "C#", "A clone of all original SuperMarioBros (NES) levels, with a few tweaks.", "2013-10-17", "direkt", "", "", "https://github.com/Mikescher/SuperBitBros", 0, "", -1);
|
||||
Do(35, "ExtendedGitGraph", "ExtendedGitGraph", 514, "Library", 2, 1, 1, "English", "PHP", "A simple php module to display a overview of you github commits", "2014-06-08", "https://github.com/Mikescher/extendedGitGraph/", "", "", "", 0, "", -1);
|
||||
Do(36, "SharkSim", "SharkSim", 428, "Simulation", 3, 1, 1, "English", "C++", "A simple implementation of the Wa-Tor cellular automaton", "2013-07-12", "", "", "", "", 0, "", -1);
|
||||
Do(37, "jQCCounter", "jQCCounter", 457, "Tool", 3, 1, 1, "English", "Java", "A little tool to find the \"line of codes\" of multiple projects", "2014-04-27", "", "", "", "https://github.com/Mikescher/jQCCounter", 0, "", -1);
|
||||
Do(38, "BefunUtils", "BefunUtils", 764, "Compiler", 4, 1, 1, "English", "C#", "My selfmade Code-to-Befunge93 compiler, with a few little extras.", "2014-08-04", "", "", "", "https://github.com/Mikescher/BefunUtils", 0, "", -1);
|
||||
Do(39, "HexSolver", "HexSolver", 423, "Tool", 5, 1, 1, "English", "C#", "An automatic parser and solver for Hexcells, Hexcells Plus and Hexcells Infinite.", "2015-05-06", "", "", "", "https://github.com/Mikescher/HexSolver", 0, "", -1);
|
||||
Do(40, "Passpad", "Passpad", 363, "Tool", 3, 1, 1, "English", "C#", "A texteditor for encrypted textfiles (AES, Twofish, Blowfish, ...)", "2015-11-26", "https://github.com/Mikescher/Passpad/releases", "", "", "https://github.com/Mikescher/Passpad", 0, "", -1);
|
||||
|
||||
}
|
||||
|
||||
void Do(int ID, string Name, string Thumbnailname, int Downloads, string Kategorie, int Sterne, int enabled, int visible,
|
||||
string Language, string programming_lang, string Description, string add_date,
|
||||
string download_url, string sourceforge_url, string homepage_url, string github_url,
|
||||
int uses_absCanv, string update_identifier, int highscore_gid)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
b.AppendLine($"<?php");
|
||||
b.AppendLine($"");
|
||||
b.AppendLine($"return ");
|
||||
b.AppendLine($"[");
|
||||
b.AppendLine($"\t'name' => '{Name}',");
|
||||
b.AppendLine($"\t'category' => '{Kategorie}',");
|
||||
b.AppendLine($"\t'stars' => {Sterne},");
|
||||
b.AppendLine($"\t'ui_language' => '{Language}',");
|
||||
b.AppendLine($"\t'prog_language' => '{programming_lang}',");
|
||||
b.AppendLine($"\t'short_description' => '{ToLiteral(Description)}',");
|
||||
b.AppendLine($"\t'add_date' => '{add_date}',");
|
||||
b.AppendLine($"\t'urls' =>");
|
||||
b.AppendLine($"\t[");
|
||||
if (!string.IsNullOrWhiteSpace(download_url)) b.AppendLine($"\t\t'download' => '{ToLiteral(download_url)}',");
|
||||
if (!string.IsNullOrWhiteSpace(sourceforge_url)) b.AppendLine($"\t\t'sourceforge' => '{ToLiteral(sourceforge_url)}',");
|
||||
if (!string.IsNullOrWhiteSpace(homepage_url)) b.AppendLine($"\t\t'homepage' => '{ToLiteral(homepage_url)}',");
|
||||
if (!string.IsNullOrWhiteSpace(github_url)) b.AppendLine($"\t\t'github' => '{ToLiteral(github_url)}',");
|
||||
b.AppendLine($"\t],");
|
||||
b.AppendLine($"\t'long_description' => function(){{ return file_get_contents(__DIR__ . '/{Name}_description.md'); }},");
|
||||
b.AppendLine($"\t'thumbnail_url' => '/images/program_thumbnails/{Name}.png',");
|
||||
b.AppendLine($"];");
|
||||
|
||||
File.WriteAllText(@"C:\Users\schwoerm\Desktop\M\hp\v4\www\rawdata\programs\" + $"{Name}.php", b.ToString(), ENC);
|
||||
File.WriteAllText(@"C:\Users\schwoerm\Desktop\M\hp\v4\www\rawdata\programs\" + $"{Name}_description.md", File.ReadAllText(@"C:\Users\schwoerm\Desktop\M\hp\v3\www\data\programs\desc\" + Name + @"\index.markdown"), ENC);
|
||||
}
|
||||
|
||||
private static string ToLiteral(string input)
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
using (var provider = CodeDomProvider.CreateProvider("CSharp"))
|
||||
{
|
||||
provider.GenerateCodeFromExpression(new CodePrimitiveExpression(input), writer, null);
|
||||
var a = writer.ToString();
|
||||
return a.Substring(1, a.Length-2);
|
||||
}
|
||||
}
|
||||
}
|
@ -126,15 +126,23 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
color: #222;
|
||||
font-weight: bold;
|
||||
|
||||
padding: 4px;
|
||||
background: #AAA;
|
||||
|
||||
}
|
||||
|
||||
.euler_pnl_header a {
|
||||
color: #222;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
.euler_pnl_header a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.euler_pnl_content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -171,9 +179,18 @@ body {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.euler_pnl_cell:hover {
|
||||
box-shadow: 0 0 4px #000000;
|
||||
}
|
||||
|
||||
.euler_pnl_cell a {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.euler_pnl_cell a:hover {
|
||||
|
13
www/fragments/blog/borderlinedef.md
Normal file
@ -0,0 +1,13 @@
|
||||
Perhaps I'm making too much Mini-Games, but hey .... here is another one:
|
||||
|
||||
I proudly present you [Borderline Defense](/programs/view/Borderline%20Defense). Borderline Defense is a funny little Space-Invaders-Clone and the final project of 2 years Delphi-AG.
|
||||
Programmed (and designed) from the members of the Delphi-AG and the two leaders (Benjamin and myself) has it grown into a playable and quite funny game.
|
||||
The background work is done by my [absCanvas](/programs/view/AbsCanvas)-Engine and the Special features are:
|
||||
|
||||
- Endless Gameplay (as long as you can last)
|
||||
- An Online-Highscore
|
||||
- A Boss Fight at stage 20 (and 40, 60, 80 etc )
|
||||
- And a ship with 10 different upgrade levels
|
||||
|
||||
So, thats it ... have fun
|
||||
Mike
|
10
www/fragments/blog/bsod.md
Normal file
@ -0,0 +1,10 @@
|
||||
Some people say flying gets safer and safer ... But see for your self:
|
||||
|
||||
![Bluescreen_01][1]
|
||||
|
||||
![Bluescreen_02][2]
|
||||
|
||||
I think I will use the train :D
|
||||
|
||||
[1]: /images/log/bsod_1.jpg
|
||||
[2]: /images/log/bsod_2.jpg
|
21
www/fragments/blog/cleanup.md
Normal file
@ -0,0 +1,21 @@
|
||||
Yesterday I decided that a lot of my website is out of date and I should probably re-evaluate whats on here.
|
||||
To be short: I completely removed the fun-page, most links were netherless broken and the rest didn't really fit this page.
|
||||
Also I re-did the Downlaodpage, you can now see
|
||||
|
||||
- absCanvas-Links
|
||||
- Versionnumbers
|
||||
- The sourcecode from a few programs
|
||||
- Sort by Date
|
||||
- The last added program on the mainpage
|
||||
|
||||
and a lot more.
|
||||
|
||||
Also I improved my Adminpage, hopefully I can now more easily upload and change programs/logs.
|
||||
|
||||
Finally I have an PSA for you: While writing my PHP-Code i found a pretty cool Editor (previously I used Notepad++):
|
||||
[Weaverslave 4](http://www.weaverslave.ws/)
|
||||
|
||||
|
||||
You all a good day
|
||||
~ Mike
|
||||
|
8
www/fragments/blog/crystalgrid.md
Normal file
@ -0,0 +1,8 @@
|
||||
The same procedure as last program ?
|
||||
The same procedureas **every** program.
|
||||
|
||||
You see nothing really different, i wrote a little game in my spare free time. And now I'm uploading it.
|
||||
It's a little game named [Crystal Grid](/programs/view/Crystal%20Grid). Im pretty proud of the difficulty. It's pretty forgiving as long as you play on `Beginner` but extremely challenging on `Impossible`.
|
||||
|
||||
If you dare (and like) you can try beat my highscore
|
||||
... Mike
|
6
www/fragments/blog/funupdate.md
Normal file
@ -0,0 +1,6 @@
|
||||
After a lot of requests i come to update the [Fun-Page](/fun/fun.php).
|
||||
The flying parts are now a good amount slower and the colors not *that* bright ...
|
||||
|
||||
Complaints can go into the guestbook.
|
||||
|
||||
Greetings Mike
|
14
www/fragments/blog/hack.md
Normal file
@ -0,0 +1,14 @@
|
||||
I have to say: "Wow" .
|
||||
|
||||
Someone really took the time to *"hack"* my website.
|
||||
Yesterday someone changed my files to display this messsage on the mainpage:
|
||||
|
||||
> <!-- Hack an! -->
|
||||
> **Diese Seite wurde gehackt.**
|
||||
> Sorry wegen der Shoutbox, die ist
|
||||
> jetzt e bissle verschoben :D
|
||||
> *Und sie bleibt es auch, bis die Sicherheitslücke entfernt ist :P*
|
||||
> <!-- Hack aus (nur zwischen den beiden Kommentaren ist etwas verändert worden)-->
|
||||
|
||||
I think if found the hole, and *hopefully* i prevented all future XSS-atacks
|
||||
I hope there will be no more ... suprises.
|
8
www/fragments/blog/inftournament.md
Normal file
@ -0,0 +1,8 @@
|
||||
Okay, okay, after a loooong time I will write something in the log.
|
||||
In the last few months there wasn't much on this site, but be sure mikescher.de is not *(yet)* dead.
|
||||
I just have a lot to do with my abi and beside that I'm working on our Clan-homepage [SemteX](http://www.semtex.org).
|
||||
|
||||
But I also wrote a few programs and I want to upload one which has gotten quite a bit of progress and is nearly finished: [Infinity Tournament](/programs/view/Infinity%20Tournament) 1.2.
|
||||
It's based on an old game by me, but writte completely frokm scratch new in my on 2D-Canvas Engine ([absCanvas](/programs/view/AbsCanvas)) ... have fun
|
||||
|
||||
*Mikescher*
|
15
www/fragments/blog/initial.md
Normal file
@ -0,0 +1,15 @@
|
||||
After a kinda long wait the new Style is finally online. You can now look at the glorious *mikescher.de 3.0*
|
||||
|
||||
Write in the (also new) Guestbook what you think about it.
|
||||
Here is a little overview over the past versions:
|
||||
|
||||
|
||||
**v1.0:** ![version 1][1]
|
||||
|
||||
**v2.0:** ![version 2][2]
|
||||
|
||||
**v3.0:** ![version 3][3]
|
||||
|
||||
[1]: /images/log/ms_de_v1.jpg
|
||||
[2]: /images/log/ms_de_v2.jpg
|
||||
[3]: /images/log/ms_de_v3.jpg
|
8
www/fragments/blog/lancontrol.md
Normal file
@ -0,0 +1,8 @@
|
||||
I have uploaded another of my older programs: [LAN-Control 2.0](/programs/view/LAN-Control).
|
||||
You probably didn't even know the 1.0 version, because i never came to publish that version either.
|
||||
And, to be quite frankly, it wasn't really a thing i would show others.
|
||||
|
||||
But now the completely rewrote version is online and if you want you can test it out.
|
||||
|
||||
|
||||
MfG Mike
|
6
www/fragments/blog/language.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Hi,
|
||||
|
||||
I am currently changing the main languages of this website to *english*.
|
||||
That means not only that all future Logs will be written in english, but also that i will translate the old ones.
|
||||
|
||||
Enjoy.
|
8
www/fragments/blog/more_euler.md
Normal file
@ -0,0 +1,8 @@
|
||||
A lot of you probably have seen [various](/programs/view/BefunUtils) [befunge](/programs/view/BefunZ) [stuff](https://github.com/Mikescher/BefunUtils) on this site.
|
||||
|
||||
But a thing I do now for a while is solving the **[Project Euler](https://projecteuler.net/)** problems in befunge.
|
||||
To celebrate fifty solved levels I want to rally you again to my **[blogpost about this project](/blog/1/Project_Euler_with_Befunge)** and the [table](/blog/1/Project_Euler_with_Befunge) with all my solved problems.
|
||||
|
||||
Have a look and perhaps feel inspired to do a few problems by your self - most of them are quite fun and challenging.
|
||||
|
||||
![](https://projecteuler.net/profile/Mikescher.png)
|
6
www/fragments/blog/newlayout.txt
Normal file
@ -0,0 +1,6 @@
|
||||
I can proudly say, i finally started the new *(and better)* Layout.
|
||||
Simultaneously i have started this log.
|
||||
|
||||
I hope many more log-entries will follow.
|
||||
|
||||
~ Mike
|
9
www/fragments/blog/spammers.md
Normal file
@ -0,0 +1,9 @@
|
||||
*grml* After you guys started spamming my guestbook I saw myself forced towards a little bit of more drastic measures.
|
||||
So you are now forced to solve a capture everytime you want to post something.
|
||||
Have fun :)
|
||||
|
||||
Btw, i took the "fun" path and tried writing my own captcha code, here you can see the result:
|
||||
|
||||
![Captcha][1]
|
||||
|
||||
[1]: /images/log/captcha_img.png
|
16
www/fragments/blog/v4.md
Normal file
@ -0,0 +1,16 @@
|
||||
When you see this Log you probably notice that this site looks a whole lot different than a few days before.
|
||||
And you you can probably guess it **I rewrote this website completely from scratch**.
|
||||
Finally there is a *real* PHP Framework behind this all ([Yii](http://www.yiiframework.com/) with [Yiistrap](http://www.getyiistrap.com/)) and my code looks kinda good and is [version controlled](https://github.com/Mikescher/www.mikescher.de).
|
||||
|
||||
My hopes are that I can now easier add new programs and that the whole page looks a bit more professional.
|
||||
If you want to see how this page has evolved over the years - here are the thumbnails of mikescher.de version `1`, `2`, `3` and the current `4`:
|
||||
|
||||
![version 1](/images/log/ms_de_v1.jpg)
|
||||
![version 2](/images/log/ms_de_v2.jpg)
|
||||
![version 3](/images/log/ms_de_v3.jpg)
|
||||
![version 4](/images/log/ms_de_v4.jpg)
|
||||
|
||||
Also look at the new [Blog section](/blog), for now there is not much content but perhaps that will change over te next few months.
|
||||
|
||||
Greetings
|
||||
~ Mikescher
|
@ -1,81 +0,0 @@
|
||||
|
||||
<?php
|
||||
|
||||
$euler = $PDO->query('SELECT * FROM ms4_eulerproblem', PDO::FETCH_ASSOC);
|
||||
|
||||
?>
|
||||
|
||||
<div class="euler_pnl_base">
|
||||
|
||||
<div class="euler_pnl_header">
|
||||
Project Euler with Befunge-93
|
||||
</div>
|
||||
<div class="euler_pnl_content">
|
||||
|
||||
<?php
|
||||
|
||||
$arr = [];
|
||||
|
||||
$max = 0;
|
||||
foreach ($euler as $problem)
|
||||
{
|
||||
$max = max($max, $problem['Problemnumber']);
|
||||
|
||||
|
||||
if ($problem['SolutionTime'] < 100) // < 100ms
|
||||
$problem['timelevel'] = 'euler_pnl_celltime_perfect';
|
||||
else if ($problem['SolutionTime'] < 15 * 1000) // < 5s
|
||||
$problem['timelevel'] = 'euler_pnl_celltime_good';
|
||||
else if ($problem['SolutionTime'] < 60 * 1000) // < 1min
|
||||
$problem['timelevel'] = 'euler_pnl_celltime_ok';
|
||||
else if ($problem['SolutionTime'] < 5 * 60 * 1000) // < 5min
|
||||
$problem['timelevel'] = 'euler_pnl_celltime_bad';
|
||||
else
|
||||
$problem['timelevel'] = 'euler_pnl_celltime_fail';
|
||||
|
||||
$arr[$problem['Problemnumber']] = $problem;
|
||||
}
|
||||
|
||||
$max = ceil($max / 20) * 20;
|
||||
|
||||
echo "<div class='euler_pnl_row'>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
for ($i = 1; $i <= $max; $i++)
|
||||
{
|
||||
$cssclass = '';
|
||||
if (key_exists($i, $arr))
|
||||
{
|
||||
$cssclass = $arr[$i]['timelevel'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$cssclass = 'euler_pnl_cell_notexist';
|
||||
}
|
||||
|
||||
echo " <div class=\"euler_pnl_cell $cssclass\">";
|
||||
echo "<a href=\"/blog/1/Project_Euler_with_Befunge/problem-" . str_pad($i, 3, '0', STR_PAD_LEFT) . "\">";
|
||||
echo "$i";
|
||||
echo "</a>";
|
||||
echo "</div>\n";
|
||||
|
||||
if (($i)%20 == 0)
|
||||
{
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class='euler_pnl_row'>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
}
|
||||
else if (($i)%10 == 0)
|
||||
{
|
||||
echo "</div>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
}
|
||||
}
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
68
www/fragments/eulerpanel.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
require __DIR__ . '/../internals/euler.php';
|
||||
|
||||
$euler = Euler::listAll();
|
||||
|
||||
$RATING_CLASSES = ['euler_pnl_celltime_perfect', 'euler_pnl_celltime_good', 'euler_pnl_celltime_ok', 'euler_pnl_celltime_bad', 'euler_pnl_celltime_fail'];
|
||||
?>
|
||||
|
||||
<div class="euler_pnl_base">
|
||||
|
||||
<div class="euler_pnl_header">
|
||||
<a href="">Project Euler with Befunge-93</a>
|
||||
</div>
|
||||
<div class="euler_pnl_content">
|
||||
|
||||
<?php
|
||||
|
||||
$arr = [];
|
||||
|
||||
$max = 0;
|
||||
foreach ($euler as $problem)
|
||||
{
|
||||
$max = max($max, $problem['number']);
|
||||
$arr[$problem['number']] = $problem;
|
||||
}
|
||||
|
||||
$max = ceil($max / 20 + 1) * 20;
|
||||
|
||||
echo "<div class='euler_pnl_row'>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
for ($i = 1; $i <= $max; $i++)
|
||||
{
|
||||
$cssclass = 'euler_pnl_cell_notexist';
|
||||
$alttitle = '';
|
||||
$href = '#';
|
||||
if (key_exists($i, $arr))
|
||||
{
|
||||
$cssclass = $RATING_CLASSES[$arr[$i]['rating']];
|
||||
$alttitle = $arr[$i]['title'];
|
||||
$href = "/blog/1/Project_Euler_with_Befunge/problem-" . str_pad($i, 3, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
echo " <div class=\"euler_pnl_cell $cssclass\">";
|
||||
echo "<a href=\"" . $href . "\" title=\"" . htmlspecialchars($alttitle) . "\" >";
|
||||
echo "$i";
|
||||
echo "</a>";
|
||||
echo "</div>\n";
|
||||
|
||||
if (($i)%20 == 0)
|
||||
{
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
echo "<div class='euler_pnl_row'>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
}
|
||||
else if (($i)%10 == 0)
|
||||
{
|
||||
echo "</div>\n";
|
||||
echo "<div class='euler_pnl_row2'>\n";
|
||||
}
|
||||
}
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
BIN
www/images/log/bsod_1.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
www/images/log/bsod_2.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
www/images/log/captcha_img.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
www/images/log/ms_de_v1.jpg
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
www/images/log/ms_de_v2.jpg
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
www/images/log/ms_de_v3.jpg
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
www/images/log/ms_de_v4.jpg
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
www/images/program_thumbnails/All in One.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
www/images/program_thumbnails/Beepster.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
www/images/program_thumbnails/BefunUtils.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
www/images/program_thumbnails/BefunZ.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
www/images/program_thumbnails/Blitzer.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
www/images/program_thumbnails/Borderline Defense.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
www/images/program_thumbnails/ClipCorn.png
Normal file
After Width: | Height: | Size: 135 KiB |
BIN
www/images/program_thumbnails/Crystal Grid.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
www/images/program_thumbnails/Deal or no Deal.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
www/images/program_thumbnails/Dynamic Link Fighters.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
www/images/program_thumbnails/ExtendedGitGraph.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
www/images/program_thumbnails/Graveyard of Numbers.png
Normal file
After Width: | Height: | Size: 59 KiB |
BIN
www/images/program_thumbnails/H2O.png
Normal file
After Width: | Height: | Size: 131 KiB |
BIN
www/images/program_thumbnails/HexSolver.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
www/images/program_thumbnails/Infinity Tournament.png
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
www/images/program_thumbnails/Keygen Dancer.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
www/images/program_thumbnails/LAN-Control.png
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
www/images/program_thumbnails/LightShow.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
www/images/program_thumbnails/Logistixx.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
www/images/program_thumbnails/NedSchend.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
www/images/program_thumbnails/Niripsa.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
www/images/program_thumbnails/Passpad.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
www/images/program_thumbnails/Penner-Bot.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
www/images/program_thumbnails/Serpilicum.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
www/images/program_thumbnails/SharkSim.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
www/images/program_thumbnails/Sieb des Eratosthenes.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
www/images/program_thumbnails/Smart Directory Lister.png
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
www/images/program_thumbnails/SuperBitBros.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
www/images/program_thumbnails/TicTacToe.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
www/images/program_thumbnails/Wikipedia - The Game.png
Normal file
After Width: | Height: | Size: 200 KiB |
BIN
www/images/program_thumbnails/Ziegenproblem.png
Normal file
After Width: | Height: | Size: 194 KiB |
BIN
www/images/program_thumbnails/absCanvas.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
www/images/program_thumbnails/exeExtract.png
Normal file
After Width: | Height: | Size: 262 KiB |
BIN
www/images/program_thumbnails/jCircuits.png
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
www/images/program_thumbnails/jClipCorn.png
Normal file
After Width: | Height: | Size: 164 KiB |
BIN
www/images/program_thumbnails/jQCCounter.png
Normal file
After Width: | Height: | Size: 124 KiB |
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
$CONFIG = require 'config.php';
|
||||
|
||||
$dsn = "mysql:host=" . $CONFIG['host'] . ";dbname=" . $CONFIG['database'] . ";charset=utf8";
|
||||
$opt = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
];
|
||||
|
||||
$PDO = new PDO($dsn, $CONFIG['user'], $CONFIG['password'], $opt);
|
20
www/internals/base.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||
|
||||
$CONFIG = require 'config.php';
|
||||
|
||||
$PDO = NULL;
|
||||
|
||||
function connect()
|
||||
{
|
||||
global $CONFIG;
|
||||
global $PDO;
|
||||
|
||||
$dsn = "mysql:host=" . $CONFIG['host'] . ";dbname=" . $CONFIG['database'] . ";charset=utf8";
|
||||
$opt = [
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_EMULATE_PREPARES => false,
|
||||
];
|
||||
|
||||
$PDO = new PDO($dsn, $CONFIG['user'], $CONFIG['password'], $opt);
|
||||
}
|
33
www/internals/blog.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
class Blog
|
||||
{
|
||||
public static function listAll()
|
||||
{
|
||||
return
|
||||
[
|
||||
[ 'id' => 5, 'date' => '2009-04-08', 'visible' => true, 'title' => 'Beginning the log', 'fragment' => 'initial.md', 'type' => 'plain', 'cat' => 'log' ],
|
||||
[ 'id' => 6, 'date' => '2009-05-01', 'visible' => false, 'title' => 'Mess with the best ...', 'fragment' => 'hack.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 4, 'date' => '2009-06-22', 'visible' => true, 'title' => 'New Layout!', 'fragment' => 'newlayout.txt', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 10, 'date' => '2009-06-28', 'visible' => true, 'title' => '"FUN" update', 'fragment' => 'funupdate.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 11, 'date' => '2009-07-05', 'visible' => true, 'title' => 'New Download: LAN Control 2.0', 'fragment' => 'lancontrol.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 12, 'date' => '2009-09-07', 'visible' => false, 'title' => 'Airline BSOD', 'fragment' => 'bsod.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 13, 'date' => '2009-11-22', 'visible' => true, 'title' => 'Spammers gonna spam', 'fragment' => 'spammers.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 15, 'date' => '2012-04-14', 'visible' => true, 'title' => 'New Download: Infinity Tournament', 'fragment' => 'inftournament.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 16, 'date' => '2012-05-27', 'visible' => true, 'title' => 'New Download: Borderline Defense', 'fragment' => 'borderlinedef.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 17, 'date' => '2012-05-28', 'visible' => true, 'title' => 'Big clean up', 'fragment' => 'cleanup.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 18, 'date' => '2013-01-03', 'visible' => true, 'title' => 'New Download: Crystal Grid', 'fragment' => 'crystalgrid.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 2, 'date' => '2014-05-14', 'visible' => true, 'title' => 'Let\'s do Befunge-93', 'fragment' => 'befunge93.md', 'type' => 'markdown', 'cat' => 'blog' ],
|
||||
[ 'id' => 14, 'date' => '2014-06-30', 'visible' => true, 'title' => 'Language changes', 'fragment' => 'language.txt', 'type' => 'plain', 'cat' => 'log' ],
|
||||
[ 'id' => 1, 'date' => '2014-07-10', 'visible' => true, 'title' => 'Project Euler with Befunge', 'fragment' => '', 'type' => 'euler', 'cat' => 'blog' ],
|
||||
[ 'id' => 3, 'date' => '2014-07-15', 'visible' => true, 'title' => '.Net format specifier Cheat Sheet', 'fragment' => 'net_format_spec.md', 'type' => 'markdown', 'cat' => 'blog' ],
|
||||
[ 'id' => 19, 'date' => '2014-08-04', 'visible' => true, 'title' => 'I am Number Four', 'fragment' => 'v4.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 7, 'date' => '2014-09-28', 'visible' => true, 'title' => 'My BFJoust arena and battle-bot', 'fragment' => 'bfjoust.php', 'type' => 'php', 'cat' => 'blog' ],
|
||||
[ 'id' => 8, 'date' => '2014-11-05', 'visible' => true, 'title' => 'Rapla Enhancement Script', 'fragment' => 'rapla_css.md', 'type' => 'markdown', 'cat' => 'blog' ],
|
||||
[ 'id' => 20, 'date' => '2015-01-09', 'visible' => true, 'title' => 'More Befunge with Project Euler', 'fragment' => 'more_euler.md', 'type' => 'markdown', 'cat' => 'log' ],
|
||||
[ 'id' => 9, 'date' => '2016-10-22', 'visible' => true, 'title' => 'A complete sudoku solver in Befunge-93', 'fragment' => 'sudoku_befunge.md', 'type' => 'markdown', 'cat' => 'blog' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
36
www/internals/euler.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||
|
||||
class Euler
|
||||
{
|
||||
public static function readSingle($f)
|
||||
{
|
||||
$a = require $f;
|
||||
$a['rating'] = self::rateTime($a);
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function listAll()
|
||||
{
|
||||
$files = glob(__DIR__ . '/../statics/euler/euler_*.php');
|
||||
|
||||
return array_map('self::readSingle', $files);
|
||||
}
|
||||
|
||||
public static function rateTime($problem)
|
||||
{
|
||||
if ($problem['time'] < 100) // < 100ms
|
||||
return 0;
|
||||
|
||||
if ($problem['time'] < 15 * 1000) // < 5s
|
||||
return 1;
|
||||
|
||||
if ($problem['time'] < 60 * 1000) // < 1min
|
||||
return 2;
|
||||
|
||||
if ($problem['time'] < 5 * 60 * 1000) // < 5min
|
||||
return 3;
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
17
www/internals/programs.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||
|
||||
class Programs
|
||||
{
|
||||
public static function readSingle($f)
|
||||
{
|
||||
$a = require $f;
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function listAll()
|
||||
{
|
||||
$files = glob(__DIR__ . '/../statics/programs/*.php');
|
||||
|
||||
return array_map(readSingle, $files);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<?php require __DIR__ . '/../internals/backend.php' ?>
|
||||
<?php require __DIR__ . '/../internals/base.php' ?>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mikescher.com</title>
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
<div id="content">
|
||||
|
||||
<?php include (__DIR__ . '/../fragments/euler.php'); ?>
|
||||
<?php include (__DIR__ . '/../fragments/eulerpanel.php'); ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
19
www/statics/euler/euler_001.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 1,
|
||||
'title' => 'Multiples of 3 and 5',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_001_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_001_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_001_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=001',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-001.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 47624,
|
||||
'time' => 62,
|
||||
'width' => 30,
|
||||
'height' => 5,
|
||||
'value' => 233168,
|
||||
];
|
5
www/statics/euler/euler_001_code.txt
Normal file
@ -0,0 +1,5 @@
|
||||
vvv: < <
|
||||
1> 1+:::3/3*-!#^_>::5/5*-!#^_v
|
||||
1$v ># v# ># v#<
|
||||
1 >:5558***-!|v$<>+\:1-!|v$<
|
||||
>^ <>$$^\ <>.@
|
3
www/statics/euler/euler_001_description.md
Normal file
@ -0,0 +1,3 @@
|
||||
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
|
||||
|
||||
Find the sum of all the multiples of 3 or 5 below 1000.
|
1
www/statics/euler/euler_001_explanation.md
Normal file
@ -0,0 +1 @@
|
||||
The solution here is pretty straight-forward, going through all numbers from 1-1000 and adding all multiples of 3 and 5 together.
|
19
www/statics/euler/euler_002.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 2,
|
||||
'title' => 'Even Fibonacci numbers',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_002_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_002_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_002_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=002',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-002.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 1669,
|
||||
'time' => 62,
|
||||
'width' => 26,
|
||||
'height' => 5,
|
||||
'value' => 4613732,
|
||||
];
|
5
www/statics/euler/euler_002_code.txt
Normal file
@ -0,0 +1,5 @@
|
||||
v>v>ppp 0>>$ 10g20g:10p+:v
|
||||
202 >00p0^|-*2/2::< vp02<
|
||||
0::0^+ g00<v**"}P ":<
|
||||
:1>^@$.g00<>*` #v_^
|
||||
>^ ^ <
|
8
www/statics/euler/euler_002_description.md
Normal file
@ -0,0 +1,8 @@
|
||||
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
|
||||
By starting with 1 and 2, the first 10 terms will be:
|
||||
|
||||
~~~
|
||||
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
|
||||
~~~
|
||||
|
||||
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
|
1
www/statics/euler/euler_002_explanation.md
Normal file
@ -0,0 +1 @@
|
||||
Also the problem here was not the algorithm, but writing and compressing it in Befunge. The code calculates the Fibonacci sequence one after each other and remembers the sum while iterating.
|
19
www/statics/euler/euler_003.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 3,
|
||||
'title' => 'Largest prime factor',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_003_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_003_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_003_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=003',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-003.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 31579516,
|
||||
'time' => 9547,
|
||||
'width' => 55,
|
||||
'height' => 4,
|
||||
'value' => 6857,
|
||||
];
|
4
www/statics/euler/euler_003_code.txt
Normal file
@ -0,0 +1,4 @@
|
||||
89197939490919v >00g10g1-:10p%#v_10g:30p1-40pv
|
||||
v+*29191929891< ^ < <_v#! %g04g03<
|
||||
>*+*+*+*+*+*+*v >"{.i "+**10p#^ #p #0 #0 <>40g:1-40p2-|
|
||||
>#^ +# *# +# *# +# *# +# *# +# <@.g03<
|
3
www/statics/euler/euler_003_description.md
Normal file
@ -0,0 +1,3 @@
|
||||
The prime factors of 13195 are 5, 7, 13 and 29.
|
||||
|
||||
What is the largest prime factor of the number 600851475143 ?
|
3
www/statics/euler/euler_003_explanation.md
Normal file
@ -0,0 +1,3 @@
|
||||
This problem is the reason why I changed the internals of my interpreter to int64 (because the numbers are too big for int32).
|
||||
|
||||
Fortunately the number is still small enough to brute-force the prime factors, going from the biggest factor to the smallest, the first factor (that is also a prime) that my code finds is the solution.
|
19
www/statics/euler/euler_004.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 4,
|
||||
'title' => 'Largest palindrome product',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_004_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_004_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_004_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=004',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-004.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 230611114,
|
||||
'time' => 77813,
|
||||
'width' => 71,
|
||||
'height' => 6,
|
||||
'value' => 906609,
|
||||
];
|
6
www/statics/euler/euler_004_code.txt
Normal file
@ -0,0 +1,6 @@
|
||||
1:010:pp5558***04p>10g1+::10p04g-00g \#v_1+:00p\$1:10p\:04g- #v_$$03g.@
|
||||
^ v $< >1# 0# 1# p# *# :# v# <
|
||||
v_v#-g1-g20g10g 1g20<p201<v_^#:/+55p10+1g10p1g10%+55: <
|
||||
$ >02g1+:02p 01 g - | > ^
|
||||
> ^ >:03g\`#v_03pv
|
||||
^ $< 0<
|
3
www/statics/euler/euler_004_description.md
Normal file
@ -0,0 +1,3 @@
|
||||
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
|
||||
|
||||
Find the largest palindrome made from the product of two 3-digit numbers.
|
1
www/statics/euler/euler_004_explanation.md
Normal file
@ -0,0 +1 @@
|
||||
Again we can write our program fast enough to brute-force the solution. So we iterate through every possible 3-digit product and check if its a palindrom.
|
19
www/statics/euler/euler_005.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 5,
|
||||
'title' => 'Smallest multiple',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_005_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_005_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_005_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=005',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-005.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 50166,
|
||||
'time' => 47,
|
||||
'width' => 73,
|
||||
'height' => 6,
|
||||
'value' => 232792560,
|
||||
];
|
6
www/statics/euler/euler_005_code.txt
Normal file
@ -0,0 +1,6 @@
|
||||
45*00p110p120p >10g20g*10p00g20g1+:20p`#v_10g.@
|
||||
^_v#`g00p03+1:g03 <p031< v <
|
||||
>10g30g% |1 <^ p01/g03g01<
|
||||
>10g30g/40p150p > 20g50g1+:50p` #v_^
|
||||
^ < |!%g05g04 <
|
||||
^<
|
3
www/statics/euler/euler_005_description.md
Normal file
@ -0,0 +1,3 @@
|
||||
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
|
||||
|
||||
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
|
11
www/statics/euler/euler_005_explanation.md
Normal file
@ -0,0 +1,11 @@
|
||||
We start with a value of `1`.
|
||||
Then we multiply one after another the numbers from `1` to `20` to our value (We call these `multiplicand` in the loop).
|
||||
|
||||
After each multiplications we search go through the numbers from `2` to `value` and search for a number `divisor` where
|
||||
|
||||
- `value % divisor == 0`
|
||||
- `(value / divisor) % {0, multiplicand} == 0`
|
||||
|
||||
Then (after we found such a number) we can reduce the value with it (`value /= divisor`).
|
||||
|
||||
The reduction steps guarantees us that we find the **smallest** number and it prevents our *Int64* numbers from overflowing
|
19
www/statics/euler/euler_006.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 6,
|
||||
'title' => 'Sum square difference',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_006_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_006_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_006_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=006',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-006.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 18897151,
|
||||
'time' => 7347,
|
||||
'width' => 72,
|
||||
'height' => 16,
|
||||
'value' => 25164150,
|
||||
];
|
16
www/statics/euler/euler_006_code.txt
Normal file
@ -0,0 +1,16 @@
|
||||
"d"10p000p>10g:00g+00p1-:#v_$010p>"c"10g::1+:*\:5:+%\5:+/6+p`#v_ v
|
||||
>$.@ ^ p01< ^ p01+1g01 < 0
|
||||
> v
|
||||
|!:\<|p01-1:g01<$$_v#!:g+6/+:5\%+:5:g01 :< p01"c"+<_v#!p01:-1g01<p01:g0<
|
||||
\ ^< >` > #v_v
|
||||
> v v-g+6/+:5\%+:5:g01< >00g ^
|
||||
##########> ^
|
||||
########## >010g:5:+%\5:+/6+pv
|
||||
##########
|
||||
########## ^ < <
|
||||
##########
|
||||
##########
|
||||
##########
|
||||
##########
|
||||
##########
|
||||
##########
|
9
www/statics/euler/euler_006_description.md
Normal file
@ -0,0 +1,9 @@
|
||||
The sum of the squares of the first ten natural numbers is,
|
||||
`1^2 + 2^2 + ... + 10^2 = 385`
|
||||
|
||||
The square of the sum of the first ten natural numbers is,
|
||||
`(1 + 2 + ... + 10)^2 = 552 = 3025`
|
||||
|
||||
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is `3025 - 385 = 2640`.
|
||||
|
||||
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
|
7
www/statics/euler/euler_006_explanation.md
Normal file
@ -0,0 +1,7 @@
|
||||
My solution here is *far* more complex than necessary, mostly because I thought the temporary numbers would get too big for int32 to handle (especially sum(1,100)^2).
|
||||
Later I found out I could just calculate the sum of the squares and the square of the sum and subtract them ...
|
||||
|
||||
But I like my solution so I'll leave it here.
|
||||
While I calculate the the second value (using the distributive property), I subtract in every step as much parts of the first value (the single elements of the addition) as I can (without going negative).
|
||||
|
||||
That way my temporary values never greatly exceed the final result.
|
19
www/statics/euler/euler_007.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 7,
|
||||
'title' => '10001st prime',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_007_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_007_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_007_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=007',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-007.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => true,
|
||||
'steps' => 21915385,
|
||||
'time' => 7628,
|
||||
'width' => 1000,
|
||||
'height' => 156,
|
||||
'value' => 104743,
|
||||
];
|
11
www/statics/euler/euler_007_code.txt
Normal file
@ -0,0 +1,11 @@
|
||||
v
|
||||
# ... #
|
||||
. . . .
|
||||
. . .
|
||||
. . . .
|
||||
# ... #
|
||||
v <
|
||||
>"d"55+*:10p3"2"*:20p*00p230p" ":01p11p10g5:+*1+50pv > 030p 040p>30g1+:30p:10g%\10g/1+g"X"- |
|
||||
v < _^#`g03g00 <|p+1/g01\%g01:g03"0"-p04:+1g04g05<
|
||||
> "X" 30g:10g%\10g/1+p30g >30g+ : 00g\` #v_$>30g1+:30p:10g%\10g/1+g" "- |>30g.@
|
||||
^p+1/g01\%g01:\" ":< ^ <
|
3
www/statics/euler/euler_007_description.md
Normal file
@ -0,0 +1,3 @@
|
||||
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
|
||||
|
||||
What is the 10 001st prime number?
|
1
www/statics/euler/euler_007_explanation.md
Normal file
@ -0,0 +1 @@
|
||||
Finally a opportunity to use my favorite algorithm: [The sieve of Eratosthenes.](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)
|
19
www/statics/euler/euler_008.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return
|
||||
[
|
||||
'number' => 8,
|
||||
'title' => 'Largest product in a series',
|
||||
'description' => function(){ return file_get_contents(__DIR__ . '/euler_008_description.md'); },
|
||||
'code' => function(){ return file_get_contents(__DIR__ . '/euler_008_code.txt'); },
|
||||
'explanation' => function(){ return file_get_contents(__DIR__ . '/euler_008_explanation.md'); },
|
||||
'url_euler' => 'http://projecteuler.net/problem=008',
|
||||
'url_raw' => 'https://raw.githubusercontent.com/Mikescher/Project-Euler_Befunge/master/processed/Euler_Problem-008.b93',
|
||||
'url_github' => 'https://github.com/Mikescher/Project-Euler_Befunge',
|
||||
'abbreviated' => false,
|
||||
'steps' => 614295,
|
||||
'time' => 234,
|
||||
'width' => 116,
|
||||
'height' => 29,
|
||||
'value' => 23514624000,
|
||||
];
|
29
www/statics/euler/euler_008_code.txt
Normal file
@ -0,0 +1,29 @@
|
||||
"v"00p54*:10p552**:20p*30p85+40p050p060p070p080p v
|
||||
>150g60p>60g:20g%\20g/9+g"0"-*60g1+:60p50g-40g-#v_:80g`#v_$>50g1+:50p30g-#v_ 970p >70g0g.70g8-40g-#v_"=",80g.@
|
||||
^ < $ ^ <
|
||||
>80p060p>60g50g+:2 0g%\20g /9+g"0"-60g9+0p6 0g1+:60p40g-#v_^
|
||||
^ < < ^p07+1g07 <
|
||||
^ <
|
||||
|
||||
|
||||
|
||||
73167176531330624919225119674426574742355349194934
|
||||
96983520312774506326239578318016984801869478851843
|
||||
85861560789112949495459501737958331952853208805511
|
||||
12540698747158523863050715693290963295227443043557
|
||||
66896648950445244523161731856403098711121722383113
|
||||
62229893423380308135336276614282806444486645238749
|
||||
30358907296290491560440772390713810515859307960866
|
||||
70172427121883998797908792274921901699720888093776
|
||||
65727333001053367881220235421809751254540594752243
|
||||
52584907711670556013604839586446706324415722155397
|
||||
53697817977846174064955149290862569321978468622482
|
||||
83972241375657056057490261407972968652414535100474
|
||||
82166370484403199890008895243450658541227588666881
|
||||
16427171479924442928230863465674813919123162824586
|
||||
17866458359124566529476545682848912883142607690042
|
||||
24219022671055626321111109370544217506941658960408
|
||||
07198403850962455444362981230987879927244284909188
|
||||
84580156166097919133875499200524063689912560717606
|
||||
05886116467109405077541002256983155200055935729725
|
||||
71636269561882670428252483600823257530420752963450
|
7
www/statics/euler/euler_008_description.md
Normal file
@ -0,0 +1,7 @@
|
||||
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
|
||||
|
||||
```
|
||||
...
|
||||
```
|
||||
|
||||
Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?
|
1
www/statics/euler/euler_008_explanation.md
Normal file
@ -0,0 +1 @@
|
||||
These kinds of problems are fun in Befunge because you can just copy the input into your program and it becomes a part of your source code.
|