code contest

Pages: 1... 456789
@Veltas,
He's always like that, and he's been banned twice because of it. It's not a big deal though. I agree with him some of the time; I think elegant code is almost always better than "fast" code. Often, simple algorithms are as fast as (and sometimes faster than) complicated ones on small sets of data, or maybe they scale better (e.g. as the data set gets larger, the decrease in performance gets smaller).
@chrisname:

Really though, when I'm talking about 'fast' code, I don't mean optimised code, I just mean the faster and more boring alternative to fancy code. But bearing that in mind I can tell why you'd like the fancy code, it's just that fancy code doesn't hold much for me considering it rarely seems to add any real insight into the way we program and is generally purely educational.

I think cool code is stuff that tackles a difficult problem in a clever and not necessarily head-on manner, or code that does something new and exciting invented by the programmer, without necessarily setting any new complexity benchmarks. Programming should be a creative thing in the way you tackle problems, and what you create with the code, and this type of code often runs fastest, but code that's just clever for the sake of clever and doesn't do anything all that great but has complicated code that takes ages to come up with and looks pretty fancy just misses the point of programming.

That's my opinion, at least.
C++ cannot be used to write awesome programs


If you don't like C++ then why bother joining a C++ forum? Games are pretty awesome programs IMO, and the vast majority of games are written in C++.
Vast majority being about 99.3% for modern games on PCs and mainstream consoles!
Protip: Ignoranceing is bliss. ;)

-Albatross
Last edited on
I'm gonna do just that now; if people would be so kind as to direct their anti-C++ comments into a more appropriate thread (or more appropriate forum) then I'd give them the time of day but I've already said my piece.
Protip2: No one cares whether one language is better than another.. Except those who's opinions won't be swayed.
@quirkyusername
You're completely missing the point. It's obvious you can write any program in any Turing-complete programming language. But, according to rapidcoder, features and syntax of C++ doesn't really allow you to write clever code - you know the code that is short but accomplishes many things, is inspiring, jaw-dropping, and generally awesome. Keep in ming we're talking about the code here, not how good the program is. It's the code contest after all.

BTW, popularity of a programming language says very little about its quality.
Abramus wrote:
Keep in ming we're talking about the code here, not how good the program is. It's the code contest after all.


Really? From what I saw, the judging criteria included:
2.performance
3.usefulness
4.no loopholes

...all of which refer to the finished program.

http://cplusplus.com/forum/lounge/41016/#msg222261

-Albatross
Last edited on
To be honest, judging criteria in this contest are not clear for me. Name suggest that the code should be the only (or at least the most important) criteria, but later discussion suggests that OP just wants "awesome program", and will not bother with looking at the code too much.
Surely the code entirely defines the binary program as well, in which case a competition based on the code may also take into account the compiled binary?
Yes, but there is a huge difference between looking at the program (how enjoyable the game is, how good graphics it has, etc.), and by looking at the code (creativity/quality of the algorithms, etc.).
True, I was just saying that judging the contest on code doesn't necessarily preclude consideration of the compiled result ;)
Last edited on

You've referred to other languages for some reason, are you trying to say that overall C++ is a crap language?


Of course not. C++ is a perfect language to get job done. Just as Java or COBOL. Boring languages to do boring stuff.


You're completely missing the point. It's obvious you can write any program in any Turing-complete programming language. But, according to rapidcoder, features and syntax of C++ doesn't really allow you to write clever code - you know the code that is short but accomplishes many things, is inspiring, jaw-dropping, and generally awesome. Keep in ming we're talking about the code here, not how good the program is. It's the code contest after all


Couldn't say it better. However, C++ has a one awesome feature, I'm astonished noone used here - template metaprogramming.

template metaprogramming

That is a very cool feature :D
Veltas wrote:
I can tell why you'd like the fancy code, it's just that fancy code doesn't hold much for me considering it rarely seems to add any real insight into the way we program and is generally purely educational.

What I mean is when you find gems like this: http://cpan.perl.org/misc/japh
All of those are Perl scripts that (usually) print the text "Just Another Perl Hacker" or some variation thereof. I love things like that. To me, they showcase the intellect and creativity of the programmer far more than sciency or mathsy algorithms, or even games, do.
7 DAYS LEFT
Last edited on
For anyone who has done the triangle assignment =]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>

using namespace std;

template<typename ret, typename para>
struct fp{
    ret (*func) (para);
    para param;
    ret operator() (){
     return func(param);
    }
    fp(ret (*a)(para),para b):func(a),param(b){}
    fp():func(NULL){}
};

void funchuh(fp<void*,char*> func,int times){
 for (int temp = 0; temp < times; temp++){
    func();
 }
}

void* say(char* it){
 cout << it;
}

int main(){

 char strtest[] = "~~~~~~~~~~~~~~~~~~~~~~~~";
 char* st2test = new(char[sizeof(strtest)]);
 for (int temp = 0; temp < sizeof(strtest) -1; temp++){
  st2test[temp] = ' ';
 }
 st2test[sizeof(strtest) -1] = '\0';

 fp<void*,char*> test;
 test.func = &say;


 for (int temp = sizeof(strtest)-1; temp>= 0; temp--){
 test.param = st2test - (temp - sizeof(strtest) + 1);
 funchuh(test,1);

 test.param = strtest + temp;
 funchuh(test,2);

 cout << "\n";

 }
 for (int temp = 0; temp< sizeof(strtest); temp++){
 test.param = st2test - (temp - sizeof(strtest) + 1);
 funchuh(test,1);

 test.param = strtest + temp;
 funchuh(test,2);

 cout << "\n";
 }
delete(st2test);
}
Last edited on
A small program I just made :P. The program reverses the order of the words in a sentence that the user enters. For example, if the user enters "I like C++", the program will output "C++ like I".

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string sentence;
	string words[100];
	int wordcount = 0;

	cout << "Enter a sentence: ";
	getline(cin, sentence);

	int length = sentence.length();

	//seperates the sentence into words
	for(int i=0; i < length; ++i)
	{
		if(sentence[i] == ' ') { ++wordcount; ++i; }
		if(wordcount >= 100) { cout << "\nERROR: Too many words.\n"; return 0; }

		words[wordcount] += sentence[i];
	}

	cout << endl;

	//displays the words (in reversed order)
	for(int i=wordcount; i >= 0; --i)
	{
		cout << words[i] << " ";
	}

	cout << endl << endl;

	return 0;
}
I will put a part of a calculating salary program that i do for my final project;))..or all if it´s ready till then..:P:P
10 may limit time?
Pages: 1... 456789