Life Programming
-
I think we'd all be in trouble if there were two... :laugh:
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Bikash Prakash Dash wrote:
Its not a serious discussion man
It was my "attempt" at describing my life as a program; what you read was the output. Then again, most 'ere just want the codez, not the details, so;
using System;
class Coffee { /* lot's of sugar */ } class Code { /* On Error Resume 0 */ }
enum ClassesOfLife { Human, Mammal, Fish, Programmer }
private class Life: IDisposable // I ain't that static, just clone me :D
{
bool alive = true; // Life should be alive by default, or it won't run
public ClassesOfLife Class { get; set; }
public bool EOL(int dummy) { return !alive; } // dummy = true :)Code Consume(Coffee\[\] food) { return new Code(); } static void Main(string\[\] args) { Func SomeRandomThing = delegate(int chance) // obfuscated? { return 0 == new Random((int)Environment.TickCount).Next(0, chance); }; using (var Life = new Life() { Class = ClassesOfLife.Programmer }) { while (!Life.EOL(1)) // the intention is to live forever { var food = new Coffee\[\] { new Coffee(), new Coffee() }; if (SomeRandomThing(20)) food = null; var code = Life.Consume(food); if (SomeRandomThing(4)) code = null; // "external events", aka heisenbug if (null == code) Life.alive = false; if (SomeRandomThing(100)) throw new NotImplementedException("No, we still got three days until the deadline, right?"); Console.WriteLine("Heartbeat, @" + Environment.TickCount); } } Console.ReadKey(); } void IDisposable.Dispose() { alive = false; Console.WriteLine("Disposed!"); // be sure to turn of inheritance. }
}
Be warned before running the code that it did not survive it's first code-review. It seems that the code does not reproduce, and thus, does not count as "life" in the way a biologist looks at it.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
Quote:
Console.WriteLine("Heartbeat, @" + Environment.TickCount);
haha Like this line
-
Without me, many things wouldn't be able to run.
cheers Marco Bertschi
You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff I'm at peace with the world and myself. - Me
I'm sure you meant ntoskrnl.exe or some other versions of Windows kernel.
more from me | GALex: C++ Library for Advanced Genetic Algorithms
-
You don't
Dispose
of me that easily!The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Hi friends , lets innovate a new programming language called Life Programming. Describe your lifestyle with a program.
while (CanCode()) {
Exist();
}
Die();/ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Without me, many things wouldn't be able to run.
cheers Marco Bertschi
You have absolutely no idea how glad I am that I have no idea at all. - OriginalGriff I'm at peace with the world and myself. - Me
Well, they wouldn't need to anymore, and they could get rid of the restraining order.
-
Xyzzy
.-. |o,o| ,| \_\\=/\_ .-""-. ||/\_/\_\\\_\\ /\[\] \_ \_\\ |\_/|(\_)|\\\\ \_|\_o\_LII|\_ \\.\_./// / | ==== | \\ |\\\_/|"\` |\_| ==== |\_| |\_|\_| ||" || || |-|-| ||LI o || |\_|\_| ||'----'|| /\_/ \\\_\\ /\_\_| |\_\_\\
plover
MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')
-
private partial class myLife {}
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
if(this) dothat(); else if(that) dothis(); else crazy();
-
Well, they wouldn't need to anymore, and they could get rid of the restraining order.
-
if(this) dothat(); else if(that) dothis(); else crazy();
Good grief no! I multitask: "this", "that" and "crazy" are parallel processes wherever possible. ;)
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Wish it was that easy, I keep getting a 'Syntax Error' and I won't run!
Dave Find Me On: Web|Facebook|Twitter|LinkedIn
Folding Stats: Team CodeProject
I get a "Invalid operation" exception when I try to jog, does that count?
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Good grief no! I multitask: "this", "that" and "crazy" are parallel processes wherever possible. ;)
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
in a state of confusion now
-
in a state of confusion now
Why? Don't you do several things at the same time? I thought everyone did.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
I get a "Invalid operation" exception when I try to jog, does that count?
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Why? Don't you do several things at the same time? I thought everyone did.
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
YA I DO , BT NOW I'M IN CONFUSE
-
YA I DO , BT NOW I'M IN CONFUSE
Sorry, I don't do SHOUTY txtspk, would you care to try again using your full keyboard? BTW: if I can write this on a tablet without a dedicated keyboard, surely you can do the same with a full, proper keyboard? :laugh:
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
-
Hi friends , lets innovate a new programming language called Life Programming. Describe your lifestyle with a program.
-
Hi friends , lets innovate a new programming language called Life Programming. Describe your lifestyle with a program.
while(alive) { wake(); eat(); poop(); if(workday) { work(); } eat(); poop(); if(lucky) { haveSex(); } else { cryWank(); } Debug.Assert(this.Meaning > 0, null); sleep(); }
-
while(alive) { wake(); eat(); poop(); if(workday) { work(); } eat(); poop(); if(lucky) { haveSex(); } else { cryWank(); } Debug.Assert(this.Meaning > 0, null); sleep(); }
Sadly (or amazingly), I actually learned something on this thread. I never knew about Debug.Assert until wasting time on this thread. So thanks for that and justifying my procrastination.
-
Eddy Vluggen wrote:
So, no matter how often you're created, there's always only one you? :-D
Otherwise it would be time to queue up Weird Al Yankovic's "I think I'm A Clone Now".
Psychosis at 10 Film at 11 Those who do not remember the past, are doomed to repeat it. Those who do not remember the past, cannot build upon it.