Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

877082 Posts in 32846 Topics- by 24286 Members - Latest Member: himowa

May 18, 2013, 01:38:10 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Programmers poetry
Pages: [1] 2
Print
Author Topic: Programmers poetry  (Read 1028 times)
omgnoseat
Level 2
**



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 Email
« 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
*****



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 Email
« 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 Email
« 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 Email
« Reply #5 on: June 14, 2012, 06:20:23 PM »

http://revasser.net/studio/ex/gencode/
Logged
omgnoseat
Level 2
**



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 Email
« 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 Email
« 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 Email
« 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 WWW
« Reply #10 on: June 15, 2012, 09:42:52 AM »

if (game.hasDesignFaults())
   abandonProject(game);
Logged

 
JMickle
Level 10
*****


lqikq come home


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

if (game.unfinished) exit;
Logged

kamac
Level 10
*****


Notorious posts editor


View Profile WWW Email
« 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
*****



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 Email
« Reply #14 on: June 15, 2012, 03:22:43 PM »

Code:
while ( not life.isDone() )
   live( life)
wend
Logged
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic