Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Real Life -> Code

game programming irl

  • Please log in to reply
10 replies to this topic

#1 xXKyojinXx

xXKyojinXx

    CC Newcomer

  • Member
  • PipPip
  • 19 posts
  • Location:Ontario, Canada
  • Learning:(Visual) Basic, Python

Posted 26 September 2013 - 09:22 AM

I'm not sure if this will work well. It probably won't. And I can only participate a little because of my lacking knowledge for programming. + I should consider a catchier name than...well..you know.

 

Here's the deal, you take real life situations and then translate them into code (of any language of your choosing).

 

For example:

 

Private Sub Form_Load()

BigMacAd = 50

BigMac = size

If size = BigMacAd Then Kyojin.Satisified = True

If size = <50 Then Kyojin.Rage = True

End Sub

 

^ The above is my interpretation of getting a Big Mac. If it's the size they say in the commercial I'm a happy gent, if not then someone is gonna get shot. Simple as that.

 

(Note: I thought this game would be a good way to improve my understanding)


Edited by xXKyojinXx, 26 September 2013 - 05:07 PM.

  • 0

#2 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 26 September 2013 - 10:58 AM

http://xkcd.com/386/

 

void Person::Logoff () {
    Internet::Iterator i ;
    while ( (i = std::find_if(internet.begin(), internet.end(), [](const Person& p) { return p.wrong(); })) != internet.end() ) {
        correct(*i);
    }
}

  • 2

Creating SEGFAULTs since 1995.


#3 xXKyojinXx

xXKyojinXx

    CC Newcomer

  • Member
  • PipPip
  • 19 posts
  • Location:Ontario, Canada
  • Learning:(Visual) Basic, Python

Posted 26 September 2013 - 05:02 PM

Sooo...are you saying I did that wrong? x'D If so, I'm only just starting! Give me a break! x'D


  • 0

#4 lespauled

lespauled

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts
  • Programming Language:C, C++, C#, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, Transact-SQL, Bash

Posted 27 September 2013 - 08:28 AM

Where are you getting size from?


  • 1
My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth

#5 xXKyojinXx

xXKyojinXx

    CC Newcomer

  • Member
  • PipPip
  • 19 posts
  • Location:Ontario, Canada
  • Learning:(Visual) Basic, Python

Posted 27 September 2013 - 08:49 AM

I don't know. It's probably redundant to equate the bigmac and size variables. But I just decided to do so to make it clear that I was reffering to the size of said burger. Nevertheless, I've said once and I'll say it again: I'm just starting to learn. And VisualBasic is my first language (that I've attempted).


  • 0

#6 Luthfi

Luthfi

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts
  • Programming Language:PHP, Delphi/Object Pascal, Pascal, Transact-SQL
  • Learning:C, Java, PHP

Posted 27 September 2013 - 08:51 AM

Private Sub Form_Load()

BigMacAd = 50

BigMac = size

If size = BigMacAd Then Kyojin.Satisified = True

If size = <50 Then Kyojin.Rage = True

End Sub

 

 

Not optimized. You should use else before the second if. You don't need the second checking if the situation already satisfies the first one.

 

 

Where are you getting size from?

 

From other invisible Sub(routine)? Lol


  • 1

#7 0xDEADBEEF

0xDEADBEEF

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 790 posts
  • Programming Language:C, Java, C++, C#, (Visual) Basic, Perl, Transact-SQL, Bash, Prolog, Others
  • Learning:Others

Posted 27 September 2013 - 10:02 AM

hmm, didn't think everything had to be 100% correct; its only a game!


  • 0

Creating SEGFAULTs since 1995.


#8 xXKyojinXx

xXKyojinXx

    CC Newcomer

  • Member
  • PipPip
  • 19 posts
  • Location:Ontario, Canada
  • Learning:(Visual) Basic, Python

Posted 27 September 2013 - 03:44 PM

Not optimized. You should use else before the second if. You don't need the second checking if the situation already satisfies the first one.

 

 

I thank you for the tip, good sir! Seems to me like this is going less well as a game and more well as a strange programming helpline for little old Kyojin though. :o


  • 0

#9 DeadLine

DeadLine

    CC Regular

  • Member
  • PipPipPip
  • 41 posts
  • Location:Belgium
  • Programming Language:Java, C#, PHP, (Visual) Basic, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, VBScript
  • Learning:C++, JavaScript, Delphi/Object Pascal, Pascal

Posted 31 May 2014 - 07:03 PM

Here's a little joke.

if (programmer.codesIn == "Java")
{
   programmer.wearsglasses = true;
}
else if (programmer.codesIn == "C#")
{
   programmer.wearsglasses = false;
}
return programmer.wearsglasses;

Edited by DeadLine, 31 May 2014 - 07:04 PM.

  • 0

#10 farrell2k

farrell2k

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 169 posts

Posted 01 June 2014 - 11:51 AM

 

Here's a little joke.

if (programmer.codesIn == "Java")
{
   programmer.wearsglasses = true;
}
else if (programmer.codesIn == "C#")
{
   programmer.wearsglasses = false;
}
return programmer.wearsglasses;
You writing C# there?

if (DeadLine.isProgrammingInJava()) {
    setStopUsingAllmanBracketStyle(true);
    switchToKAndR();
    switchToComparingStringsWithEqualsMethod();
}   else {
        System.out.println("Yep, I'm an idiot, and he is writing C# :).");
        pleaseContinue();   
}

Edited by farrell2k, 01 June 2014 - 11:51 AM.

  • 0

Averageloser.com - I used to be a programmer like you, then I took a -> in the knee. 


#11 DeadLine

DeadLine

    CC Regular

  • Member
  • PipPipPip
  • 41 posts
  • Location:Belgium
  • Programming Language:Java, C#, PHP, (Visual) Basic, JavaScript, PL/SQL, Delphi/Object Pascal, Visual Basic .NET, Pascal, VBScript
  • Learning:C++, JavaScript, Delphi/Object Pascal, Pascal

Posted 01 June 2014 - 01:36 PM

DeadLine.IsProgrammingInC# = true;

:thumbup1:


  • 0





Also tagged with one or more of these keywords: game, programming irl

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download