Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 18, 2024, 12:08:02 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Programmers poetry
Pages: [1] 2
Print
Author Topic: Programmers poetry  (Read 2627 times)
Eendhoorn
Level 6
*

Quak


View Profile
« on: June 14, 2012, 04:48:23 PM »

Post up your solution to real life problems in abstract code. Bonus points for writing "real code" with existing classes used as metaphors for the things they represent.
Here is my go:

Code:
public function Solve()
{
for (i:int = 0; i < conflicts.length; ++i)
{
var cachedItem = MEMORY.cache[conflicts[i]].ID;
if (cachedItem != null)
{
conflicts[i].resolve(cachedItem);
}else
{
//TODO
}
}
}

A nice cheesy one; Learning from past mistakes.
- The conflicts represent the problems
- The ID of the conflict represent the type of problem
- The cache represents solutions to old problems

Problem -> cache is checked for solution -> apply solution that has the same problem ID to old problem

Another one:
Code:
public function Compare()
{
entities.Sort
(
delegate(Entity e1, Entity e2)
{
return p1.gender.CompareTo(p2.gender);
}
);
}

Bros before hoes.

Yeah it's very late.
« Last Edit: June 15, 2012, 06:34:21 AM by omgnoseat » Logged

zacaj
Level 3
***


void main()


View Profile WWW
« Reply #1 on: June 14, 2012, 04:53:54 PM »

Code:
groundTime--
if touchingGround()
groundTime=10

if spacebarPressed() and groundTime>0
yVelocity+=jumpSpeed*groundTime
My super elegant jump code. Handles controllable height jumps and leeway on ledges.

I hope I'm understanding the topic correctly...
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #2 on: June 14, 2012, 04:56:23 PM »

Code:
while(alive){
  read_lame_posts_on_tigsource();
}
regret();

 Well, hello there!
Logged

Maud'Dib Atreides
Level 4
****


Obsessed with space


View Profile WWW
« Reply #3 on: June 14, 2012, 05:39:24 PM »

using System.ADHD;

public bool motivated = true; //Sweet, we're off to a good start

public void Main()
{

while (motivated)
{
      DrawPixelArt(ideas, quality);
      ProgramGame(ideas, quality);
      
    ideas -- ;
    quality -- ;

}

motivated = Convert.ToBoolean(ADHD.GetRandomNumber(0,1)); //Oh boy

}
« Last Edit: June 14, 2012, 05:46:14 PM by # » Logged

Guy: Give me all of your money.
Chap: You can't talk to me that way, I'M BRITISH!
Guy: Well, You can't talk to me that way, I'm brutish.
Chap: Somebody help me, I'm about to lose 300 pounds!
Guy: Why's that a bad thing?
Chap: I'M BRITISH.
zacaj
Level 3
***


void main()


View Profile WWW
« Reply #4 on: June 14, 2012, 05:41:53 PM »

while (motivated or !motivated)
 work()
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
Morroque
Level 1
*



View Profile WWW
« Reply #5 on: June 14, 2012, 06:20:23 PM »

http://revasser.net/studio/ex/gencode/
Logged
Eendhoorn
Level 6
*

Quak


View Profile
« Reply #6 on: June 15, 2012, 06:34:11 AM »

Code:
while(alive){
  read_lame_posts_on_tigsource();
}
regret();

 Well, hello there!
How is one able to regret when he is not alive?
You clearly lack the skills for this complicated form of poetry  Giggle

using System.ADHD;

public bool motivated = true; //Sweet, we're off to a good start

public void Main()
{

while (motivated)
{
      DrawPixelArt(ideas, quality);
      ProgramGame(ideas, quality);
      
    ideas -- ;
    quality -- ;

}

motivated = Convert.ToBoolean(ADHD.GetRandomNumber(0,1)); //Oh boy

}
I don't have ADHD, but I'm sure we all have moments like this haha.


Code:
groundTime--
if touchingGround()
groundTime=10

if spacebarPressed() and groundTime>0
yVelocity+=jumpSpeed*groundTime
My super elegant jump code. Handles controllable height jumps and leeway on ledges.

I hope I'm understanding the topic correctly...
Sorry, you did not. But that piece of code is pretty handy nonetheless haha.

This is brilliant.
Logged

Claw
Level 4
****



View Profile WWW
« Reply #7 on: June 15, 2012, 06:45:48 AM »

using System.ADHD;

public bool motivated = true; //Sweet, we're off to a good start

public void Main()
{

while (motivated)
{
      DrawPixelArt(ideas, quality);
      ProgramGame(ideas, quality);
      
    ideas -- ;
    quality -- ;

}

motivated = Convert.ToBoolean(ADHD.GetRandomNumber(0,1)); //Oh boy

}

Shouldn't the motivated = randomnumber line be inside the while loop? Else you will always be motivated but your ideas and quality would run to minus infinity  Corny Laugh

I may be taking this too seriously.
Logged

Morroque
Level 1
*



View Profile WWW
« Reply #8 on: June 15, 2012, 08:11:44 AM »


Thank ye, kind sir.

It was actually denied publication for the anthnology "Thinking Machines: Programmer Poets and Poems about Computers" on the editorial grounds of "damnit, I really want it in, but it would take up too many pages."

Another two things of mine did get in. Here's one of 'em:



I kind of feel like this one was a bit half-assed, but for whatever reason the editor liked it.
Logged
Maud'Dib Atreides
Level 4
****


Obsessed with space


View Profile WWW
« Reply #9 on: June 15, 2012, 08:42:54 AM »

using System.ADHD;

public bool motivated = true; //Sweet, we're off to a good start

public void Main()
{

while (motivated)
{
      DrawPixelArt(ideas, quality);
      ProgramGame(ideas, quality);
      
    ideas -- ;
    quality -- ;

}

motivated = Convert.ToBoolean(ADHD.GetRandomNumber(0,1)); //Oh boy

}

Shouldn't the motivated = randomnumber line be inside the while loop? Else you will always be motivated but your ideas and quality would run to minus infinity  Corny Laugh

I may be taking this too seriously.

No no you have a point. I was debating with myself about it before I posted

while (motivated or !motivated)
 work()

LOL
Logged

Guy: Give me all of your money.
Chap: You can't talk to me that way, I'M BRITISH!
Guy: Well, You can't talk to me that way, I'm brutish.
Chap: Somebody help me, I'm about to lose 300 pounds!
Guy: Why's that a bad thing?
Chap: I'M BRITISH.
Quarry
Level 10
*****


View Profile
« Reply #10 on: June 15, 2012, 09:42:52 AM »

if (game.hasDesignFaults())
   abandonProject(game);
Logged
JMickle
Level 10
*****



View Profile
« Reply #11 on: June 15, 2012, 12:38:12 PM »

if (game.unfinished) exit;
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #12 on: June 15, 2012, 12:49:01 PM »

Code:
if(ideas.count() < too_few) {
    int action = rand()%4;
    if(action < 2)
        Programmer.Have(NAP);
    else
        Programmer.Play(GAME);
}


@EDIT

And bigger one.

Code:
for(int n=0; n<problems.size(); n++)
{
    int solved = problems[n].tryToSolve(Programmer.tired_level);
    if(solved == 1)
    {
        continue;
    } else {
        while(solved == 0)
        {
            Programmer.tired_level++;
            solved = problems[n].tryToSolve(Programmer.tired_level);
            if(solved == 0)
            {
                Programmer.Rage();
                Programmer.Cry();
                if(Programmer.tired_level >= Programmer.critic_tired_level)
                {
                    Programmer.Have(NAP);
                    Programmer.tired_level = 0;
                }
            } else {
                Programmer.WriteAPost(tigsource,happy_programmers_room,Programmer.ProblemSolvedString);
            }
        }
    }
}
« Last Edit: June 15, 2012, 12:55:00 PM by kamac » Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #13 on: June 15, 2012, 03:14:18 PM »

Code:
while(alive){
  read_lame_posts_on_tigsource();
}
regret();

 Well, hello there!
How is one able to regret when he is not alive?
You clearly lack the skills for this complicated form of poetry  Giggle

[/quote]

its my poem, i can regret when i'm dead in it if want, I HAVE THAT RIGHT!EK!O!JKEPRJOP!R  Angry Angry Evil Cheesy Blink Shocked
Logged

nikki
Level 10
*****


View Profile
« Reply #14 on: June 15, 2012, 03:22:43 PM »

Code:
while ( not life.isDone() )
   live( life)
wend
Logged
Pineapple
Level 10
*****

~♪


View Profile WWW
« Reply #15 on: June 15, 2012, 04:03:29 PM »

Code:
while (currenttime.hour!=23){sleep(60000);}
stamina-=10;
for(int x=0;x<=many;x++;){library.process(volume[x]);}
sleep(100);
listen();
print("Only this, and nothing more.");
Logged
Maud'Dib Atreides
Level 4
****


Obsessed with space


View Profile WWW
« Reply #16 on: June 15, 2012, 05:38:12 PM »

Code:
while(alive){
  read_lame_posts_on_tigsource();
}
regret();

 Well, hello there!
How is one able to regret when he is not alive?
You clearly lack the skills for this complicated form of poetry  Giggle


its my poem, i can regret when i'm dead in it if want, I HAVE THAT RIGHT!EK!O!JKEPRJOP!R  Angry Angry Evil Cheesy Blink Shocked

[/quote]

Unless

Your life is a game within a game

Inception
Logged

Guy: Give me all of your money.
Chap: You can't talk to me that way, I'M BRITISH!
Guy: Well, You can't talk to me that way, I'm brutish.
Chap: Somebody help me, I'm about to lose 300 pounds!
Guy: Why's that a bad thing?
Chap: I'M BRITISH.
Mega
Level 1
*



View Profile
« Reply #17 on: June 15, 2012, 07:08:32 PM »

int main()
{

 int the_day, the_rain;

 OPEN fields;

 while(end=1)
 {
   plains
 }

------------------------------

void the_sky = #0000FF
nothing do while(this == true)
{
    for(;I=love && this == u;)
    {
      return true;
    }
}

 
}
Logged
Hedgehodg
Level 1
*


...


View Profile
« Reply #18 on: June 17, 2012, 01:34:41 AM »

I just wasted 10 minutes of my life.

Code:
static HashMap<String, HomeworkItem> homework = new HashMap<String, HomeworkItem>;

static boolean school = true;
static boolean alive = true;
static boolean eaten = false;

static const long day =  86400000;
static const long hour = 3600000;

public static void main(String[] args)  {
    while (alive)  {
        if (school)  {
             checkHomework();
             work();
        } else  {
            if (!eaten)  { eat(); }
            
            doHomework();
            code();
        }

        if (System.getMilliseconds() > 9 * hour && System.getMilliseconds() <= 15 * hour) {
            school = true;
            eat = true;
        } else {
            if (!eaten())  {
               eat = false;
            }        

            school = false;    
        }
    }
}

private static void doHomework()  {
    String[] keys = homework.keySet();

    for (int i = 0; i < keys.length; i++)  {
        homework.get(keys[i]).do();
        homework.remove(keys[i]);
    }
}

public static void checkHomework()  {
    if (School.hasHomework("darestium"))  {
        for (int i = 0; i < School.getAllHomework("darestium").toArray().length; i++)  {
            // School ".getHomework(String studentName)" pops the next homework task
            homework.put(School.getHomework("darestium"));
        }
    }
}

public static void code()  {
    System.out.println("10 PRINT \"I AM SO GUD @ DIS.\"");
    System.out.println("20 GOTO 10");
}

public static void work()  {
    System.out.println("Working...   :cavestory:");
}
« Last Edit: June 17, 2012, 02:07:35 AM by darestium » Logged

Previously known as "darestium"...
metaldemon
Level 0
**



View Profile WWW
« Reply #19 on: June 17, 2012, 05:30:14 AM »

public static int boredom_due_to_coding = 0;
public static bool isgaming = false;


public void Update()
{
if ( isgaming == true )
{
boredom_due_to_coding--;
if ( boredom_due_to_coding == 0 )
   isgaming = false;
return;
}
boredom_due_to_coding++;
if ( boredom_due_to_coding > 20 )
{
VisualStudio.Dispose();
VisualStudio.Minimize();
string[] gamestoplay = new string[] { "justcause2.exe", "gta4.exe", "skyrimlauncher.exe", "Duke3d.exe" };

Random rand = new Random();
int gametoplay = rand.Next(0, gamestoplay.Length);
Playgame(gametoplay);
}


}

public void Playgame(string game)
{
isgaming = true;
}



Like this? thats probably working in my mind
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic