|
Title: Programmers poetry Post by: omgnoseat 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. Title: Re: Programmer's poetry Post by: zacaj on June 14, 2012, 04:53:54 PM Code: groundTime-- My super elegant jump code. Handles controllable height jumps and leeway on ledges. if touchingGround() groundTime=10 if spacebarPressed() and groundTime>0 yVelocity+=jumpSpeed*groundTime I hope I'm understanding the topic correctly... Title: Re: Programmer's poetry Post by: eigenbom on June 14, 2012, 04:56:23 PM Code: while(alive){ read_lame_posts_on_tigsource(); } regret(); :eyebrows: Title: Re: Programmer's poetry Post by: Maud'Dib Atreides 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 } Title: Re: Programmer's poetry Post by: zacaj on June 14, 2012, 05:41:53 PM while (motivated or !motivated)
work() Title: Re: Programmer's poetry Post by: Morroque on June 14, 2012, 06:20:23 PM http://revasser.net/studio/ex/gencode/
Title: Re: Programmer's poetry Post by: omgnoseat on June 15, 2012, 06:34:11 AM Code: while(alive){ read_lame_posts_on_tigsource(); } regret(); :eyebrows: You clearly lack the skills for this complicated form of poetry :giggle: using System.ADHD; I don't have ADHD, but I'm sure we all have moments like this haha.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 } Code: groundTime-- My super elegant jump code. Handles controllable height jumps and leeway on ledges. if touchingGround() groundTime=10 if spacebarPressed() and groundTime>0 yVelocity+=jumpSpeed*groundTime I hope I'm understanding the topic correctly... http://revasser.net/studio/ex/gencode/ This is brilliant.Title: Re: Programmer's poetry Post by: Claw 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 :laughter: I may be taking this too seriously. Title: Re: Programmer's poetry Post by: Morroque on June 15, 2012, 08:11:44 AM http://revasser.net/studio/ex/gencode/ This is brilliant.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: (http://revasser.net/studio/lit_pt_segmentation_full.png) I kind of feel like this one was a bit half-assed, but for whatever reason the editor liked it. Title: Re: Programmer's poetry Post by: Maud'Dib Atreides 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 :laughter: 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 Title: Re: Programmers poetry Post by: Quarry on June 15, 2012, 09:42:52 AM if (game.hasDesignFaults())
abandonProject(game); Title: Re: Programmers poetry Post by: JMickle on June 15, 2012, 12:38:12 PM if (game.unfinished) exit;
Title: Re: Programmers poetry Post by: kamac 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); } } } } Title: Re: Programmers poetry Post by: eigenbom on June 15, 2012, 03:14:18 PM Code: while(alive){ read_lame_posts_on_tigsource(); } regret(); :eyebrows: 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 >:( >:( >:D :lol: :blink: :o Title: Re: Programmers poetry Post by: nikki on June 15, 2012, 03:22:43 PM Code: while ( not life.isDone() ) live( life) wend Title: Re: Programmers poetry Post by: Pineapple 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."); Title: Re: Programmers poetry Post by: Maud'Dib Atreides on June 15, 2012, 05:38:12 PM Code: while(alive){ read_lame_posts_on_tigsource(); } regret(); :eyebrows: 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 >:( >:( >:D :lol: :blink: :o [/quote] Unless Your life is a game within a game Inception Title: Re: Programmers poetry Post by: Mega 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; } } } Title: Re: Programmers poetry Post by: Hedgehodg 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:"); } Title: Re: Programmers poetry Post by: metaldemon 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 Title: Re: Programmers poetry Post by: Quarry on June 17, 2012, 07:26:44 AM The code is bugged, you are not launching the game
Title: Re: Programmers poetry Post by: metaldemon on June 17, 2012, 08:05:38 AM The code is bugged, you are not launching the game flagnimmit! you're right! :handshakeL: :epileptic: :handshakeR: Title: Re: Programmers poetry Post by: Hedgehodg on June 17, 2012, 03:06:21 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."); The raven? Title: Re: Programmers poetry Post by: omgnoseat on June 17, 2012, 03:46:54 PM Talking about your day or programming isn't poetry, noobs!
Take a look at this guy. int main() Words like sky and love, thats the stuff.{ 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; } } } Title: Re: Programmers poetry Post by: Pineapple on June 17, 2012, 06:14:57 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."); The raven? nevermore Title: Re: Programmers poetry Post by: TaintedFork on June 17, 2012, 08:29:44 PM Code: if(self.isProgrammingInLua) then self:feelLike("shit"); end Lua is so unconventional. :mockangry: Anyway, there's also this: http://moviesascode.net/ (http://moviesascode.net/) |