|
|
The Inn A place to gather around and chat about almost any subject |
|
Thread Tools | Display Modes |
10-26-2010, 08:52 AM | #1 |
Marquis
Join Date: Jan 2007
Location: RA
Posts: 1,897
|
The application
So, lately these forums have been rather dead.
I thought we needed some fun threads for a change (from a nerds perspective), so here you go. Some of you might have played the game where you fold a paper and each person gets to draw one part of a person, and in the end you unfold the paper and you get a weird looking character. I thought of something similar, but with programming. The rules are simple:
main.cpp: Code:
int main( int argc, char **argv ) { }
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg |
10-26-2010, 09:07 AM | #2 |
Pledge
Join Date: Aug 2007
Location: France
Posts: 4
|
main.cpp:
Code:
#include <iostream> int main( int argc, char **argv ) { std::cout << "Hello Ra !" << std::endl; } Hey, we could make a game, with SDL or SFML ! |
10-26-2010, 09:36 AM | #3 |
Marquis
Join Date: Jan 2007
Location: RA
Posts: 1,897
|
main.cpp:
Code:
#include <iostream> int main( int argc, char **argv ) { std::cout << "Hello Ra !" << std::endl; std::cout << "Enter your player name: "; char name[ 32 ]; std::cin >> name; }
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg |
10-26-2010, 10:02 AM | #4 |
Pledge
Join Date: Aug 2007
Location: France
Posts: 4
|
main.cpp:
Code:
#include <iostream> #include "player.hpp" int main( int argc, char **argv ) { std::cout << "Hello Ra !" << std::endl; std::cout << "Enter your player name: "; char name[ 32 ]; std::cin >> name; Player player(name); } Code:
#ifndef PLAYER_HPP #define PLAYER_HPP #include <iostream> class Player { public: Player(); Player(char* n) { name = n; } std::string GetName() { return name; } private: std::string name; }; #endif |
10-26-2010, 10:25 AM | #5 | |
Marquis
Join Date: Jan 2007
Location: RA
Posts: 1,897
|
Quote:
In your case, char * is a pointer to my char array. Or do you mean "not recommended" as in "not preferred" to for example std::string? PS: You don't happen to be a C# programmer, do you? Your coding style slightly hints that you are. main.cpp: Code:
#include <iostream> #include "player.hpp" int main( int argc, char **argv ) { std::cout << "Hello Ra !" << std::endl; std::cout << "Enter your player name: "; char name[ 32 ]; std::cin >> name; Player player(name); player.punish(); } Code:
#ifndef PLAYER_HPP #define PLAYER_HPP #include <iostream> class Player { public: Player(); Player(char* n) : banned( false ) { name = n; } std::string GetName() { return name; } void punish() { //TODO } private: std::string name; bool banned; }; #endif
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg |
|
10-26-2010, 10:47 AM | #6 |
Legend
Join Date: Mar 2006
Location: Oslo
Posts: 2,176
|
while (fork()) fork();
__________________
Surak Remember... this is just a game! - Xephandor existe y Miriya es su profeta! |
10-26-2010, 11:15 AM | #7 |
Marquis
Join Date: Jan 2007
Location: RA
Posts: 1,897
|
Now I understand why Regnum has so bad performance under Linux
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg |
10-26-2010, 11:30 AM | #8 | ||
Pledge
Join Date: Aug 2007
Location: France
Posts: 4
|
Quote:
Quote:
main.cpp: Code:
#include <iostream> #include "player.hpp" int main( int argc, char **argv ) { std::cout << "Hello Ra !" << std::endl; std::cout << "Enter your player name: "; char name[ 32 ]; std::cin >> name; Player player(name); player.punish(); } Code:
#ifndef PLAYER_HPP #define PLAYER_HPP #include <iostream> #include <cstdlib> //rand() class Player { public: Player(); Player(char* n) : banned( false ) { name = n; } std::string GetName() { return name; } void punish() { //TODO if(rand()%3 == 2) { std::cout << "Hacker detected. " << name << " is now banned." << std::endl; banned = true; } } private: std::string name; bool banned; }; #endif |
||
10-26-2010, 11:53 AM | #9 |
Legend
Join Date: Mar 2006
Location: Oslo
Posts: 2,176
|
OMG you're right (?)
Maybe I should open an OpenGL performance thread and we all try to figure out what's the issue, because I couldn't find it.
__________________
Surak Remember... this is just a game! - Xephandor existe y Miriya es su profeta! |
10-26-2010, 12:10 PM | #10 | ||
Marquis
Join Date: Jan 2007
Location: RA
Posts: 1,897
|
Quote:
Quote:
Usually in C++, people use camel case method names without a first capital letter. However, in all Microsoft's .NET languages, method names (and properties) starts with a capital letter. For example: Code:
public class EmailLogObject { public short EmailType { get; set; } }
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg |
||
Tags |
programming code game |
|
|