Thread: Anybody up for a game?

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262

    Anybody up for a game?

    Hello all,

    I had an idea for a nice little game... So just checking in to see if anybody is interested in joining. You know the game where a group of people write a story, but everybody is allowed to write only a single sentence? That, except for coding.

    The goal is to finish a small and easy assignment, but everybody is only allowed to write either a single line or a single expression or statement (where grouped expressions count as multiple expressions, you all understand the rules by now more or less and it's too much hassle to write it out in a formal and "uncheatable" way so I won't even bother).
    The question is if we can write the assignment like that. It will be difficult: people must consider what variables are going to be used, and understand each other's variable naming. It might even be good practice to write easily readable code, and to learn to read other programmer's code.

    If enough are interested, we can do it. If not, this thread will die anyway...

  2. #2
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    What's the program supposed to do?

    Also, I suggest you start it with the int main, return 0, includes, etc. otherwise no one will start b/c they don't want to waste their one line on the meaningless crap.

    EDIT: FWIW, I like the idea. It does sound fun.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I'd rather each person write a module. Interfacing modules offers the same challenges as one line per person but is also more constructive and useful in the end.

  4. #4
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Sounds like fun. I'm in!
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    169
    Quote Originally Posted by User Name: View Post
    What's the program supposed to do?
    Compile?

    I like this idea.

  6. #6
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Sure, why not!
    Devoted my life to programming...

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Okay, good, I guess there's enough people to join then. Does anybody have a good assignment to do this for? Like a homework question they remember, that's difficult enough (I'd say it should become between 50-100 lines of code)...

  8. #8
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    You should get all the participants to sign-up first, so you can pre-determine the order (first to reply could be complicated since you may have to think a bit before posting).

    assignment ideas:
    - sorting is always classic (especially if you don't say which algo in advance)
    - Compute word frequencies in a file, output sorted list.
    - Compute word to document associations in a directory of files (inverted index)
    - ...

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by Perspective View Post
    You should get all the participants to sign-up first, so you can pre-determine the order (first to reply could be complicated since you may have to think a bit before posting).

    assignment ideas:
    - sorting is always classic (especially if you don't say which algo in advance)
    - Compute word frequencies in a file, output sorted list.
    - Compute word to document associations in a directory of files (inverted index)
    - ...
    Hmmm that's a good question, whether people should sign up. If it is avoidable, I think that's better because people might only read the thread later on. Here are my proposed rules, and my question to you guys: do you guys agree with it?

    * The application is to be written in C++. [Or should we make it C? C++ allows a relatively more difficult assignment as things like sorting can easily be done using the STL]
    * A person may only add to the application if two others added after his/her last addition. [unless it's turn based, but then it's obvious]
    * An addition may only be appended to the source code; changing is not allowed.
    * A single addition may contain only one of the "blacklisted" characters and if it does this character must be the last character, with the only exception of whitespaces.
    * The blacklisted characters are: a semicolon ( ; ) and an opening brace ({).
    * The use of the "comma operator" is forbidden. Comma's are allowed of course in function definitions, function calls and to declare more than one variable on a single line. [otherwise you can add as many expressions as you wish, comma seperated]
    * Comments are not allowed, nor is communicating the purpose of certain additions in any other method to the other participants.
    * Macro's are not allowed.
    * At every addition, one may also add a single "#include" statement any place in the code.
    * Any person making an addition that makes it impossible (which is to say, no participant can find a solution) to successfully complete the application because of a logic error, the person loses and no longer participates; the application is restored to the version before his last change and the game continues. Syntax errors are exempted from this for typo's and the like.

    So, a valid addition would be "int main(){" (which will be my first addition). Another valid addition would be "int a, b = 2;", though it would be fairly hard to understand what a and b are supposed to be. An invalid addition would be "for(int i = 0; i < n; ++i){": that is actually three different additions, "for(int i = 0;", "i < n;" and "++i){". So that one can write a for loop, but the rest will have to know exactly what way you're going. And if someone writes something bad, the next persons will have to move in to fix the bug.

    So, what do you guys think of the rules?
    Last edited by EVOEx; 04-13-2011 at 10:31 AM.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by EVOEx
    * An addition may only be appended to the source code; changing is not allowed.
    Even with the exception for #include, I note thats this means that if the game starts with the global main function, then no other functions will be defined.

    Quote Originally Posted by EVOEx
    * The blacklisted characters are: a semicolon ( ; ) and an opening brace ({).
    So <% and ??< are not blacklisted (or rather, restricted)?

    Quote Originally Posted by EVOEx
    * Comments are not allowed, nor is communicating the purpose of certain additions in any other method to the other participants.
    You might want to clarify what "any other method" really means. As-is, your "for(int i = 0;" is invalid because i is a typical name for a loop index, and indeed the variable is used as a loop index, so the purpose of the variable was communicated by its name.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by laserlight View Post
    Even with the exception for #include, I note thats this means that if the game starts with the global main function, then no other functions will be defined.
    Why not? Isn't this standard compliant? I've never read the standard completely so I'm not sure:
    Code:
    #include <iostream>
    
    int main()
    {
      void test();
      test();
    }
    
    void test()
    {
      std::cout << "TEST" << std::endl;
    }
    Quote Originally Posted by laserlight View Post
    So <% and ??< are not blacklisted (or rather, restricted)?
    Fair point. Any other way to circumvent the rules you can think of? ;-).

    Quote Originally Posted by laserlight View Post
    You might want to clarify what "any other method" really means. As-is, your "for(int i = 0;" is invalid because i is a typical name for a loop index, and indeed the variable is used as a loop index, so the purpose of the variable was communicated by its name.
    Also a good point... I'll edit the rules soon ;-).

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by EVOEx
    Why not? Isn't this standard compliant? I've never read the standard completely so I'm not sure:
    Oh yeah, it should be okay then. Class definitions would still pose a problem though.

    Quote Originally Posted by EVOEx
    Any other way to circumvent the rules you can think of? ;-).
    Statement chaining would still be possible by using operator&&, but to get the full benefit I think a pair of function templates would need to be defined first, which would be a challenge anyway
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #13
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    In a nutshell, be careful what you write, there's no turning back!
    Oh, i have a feeling that the code in the end will be a big mess!
    Devoted my life to programming...

  14. #14
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Count me in

  15. #15
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by EVOEx View Post
    So, what do you guys think of the rules?
    I think the more rules we make the less fun we're going to have. And in general, I think most of the rules proposed belong in obfuscated code contests.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Should I use a game engine in making a RPG game?
    By m3rk in forum Game Programming
    Replies: 6
    Last Post: 01-26-2009, 04:58 AM
  2. Guessing game: how to quit the game?
    By hzr in forum C Programming
    Replies: 5
    Last Post: 12-18-2008, 10:53 AM
  3. craps game & dice game..
    By cgurl05 in forum C Programming
    Replies: 3
    Last Post: 03-25-2006, 07:58 PM
  4. Game Designer vs Game Programmer
    By the dead tree in forum Game Programming
    Replies: 8
    Last Post: 04-28-2005, 09:17 PM
  5. Game Designer vs Game Programmer
    By the dead tree in forum General Discussions
    Replies: 2
    Last Post: 04-27-2005, 03:50 AM