Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

MyCoolStory.cpp

Name: Anonymous 2011-04-06 9:56

>write awesome but buggy as hell C program to kick ass at minesweeper
>1 second top score on expert mode.  .47 seconds if I use a clone that keeps track of decimals.
>nagging feeling that I'm being a noob by writing in C and not C++
>learn C++ and rewrite program using classes and maps and vectors and lists and that kind of shit instead of just arrays.
>program works perfectly now, code is much cleaner, but it can't solve an expert board in under 10 seconds
>switch on every speed optimization I can find in Visual Studio
>times down to 6-7 seconds
>decide to rewrite the whole thing in C again from scratch so maybe it can be fast AND reliable at the same time
>change mind and decide to bitch to /prog/ instead and then take a nap

Name: Anonymous 2011-04-06 9:57

>realize greentext doesn't work on textboards

Name: Anonymous 2011-04-06 10:04

>>1
Yep, you seem to be a bad enough programmer to qualify as a "C hacker 4lyfe".

Name: Anonymous 2011-04-06 10:06

>>2
'>realize you don't know shit about textboards

Name: Anonymous 2011-04-06 10:07

>times down to 6-7 seconds
I have a feeling that some shitty coder doesn't use magnificent PassByReference.

No really. How else he can achieve some slowdown?

Name: Anonymous 2011-04-06 10:07

>>4 ashamed himself.

Name: Anonymous 2011-04-06 10:15

>>5
yeah, no.

the main difference is that instead of looping over a 16x30 array of 10-15 byte structs defining the state of a board square, it's looping over a map<,> with user-defined classes for both entries.

also, i use set_difference and set_intersection to pick out sections of the board to analyze instead of picking elements out of an array.

Name: Anonymous 2011-04-06 10:23

I have 20 years programming experience writing HUGE windows games solvers that you couldnt even comprehend. I wrote an ANSI minesweeper solver when I was 12 years old.

You should just accept everything I say, I dont HAVE to give any reasons for my arguments because I am an EXPERT PROGRAMMER.

Name: Anonymous 2011-04-06 10:32

>>7
the main difference is that instead of looping over a 16x30array of 10-15 byte structs defining the state of a board square, it's looping over a map<,>
I literally slapped my forehead with my right hand and held it there for a couple of seconds, as if shielding myself from the idiocy emanated by the image of your statement on my computer screen.

Go suck a dick, faggot, you are not born for programming.

Wait, before you go, C++ has a lot of data structures, why did you choose a map specifically, why not an std::priority_queue? Or an std::stack of std::deques of std::priority_queues? If you don't give a fuck, why not go full retard, you should use every single of them, it's C++ motherfucker!

Now go, those dicks aren't going to suck themselves.

Name: Anonymous 2011-04-06 10:36

When I was 8-years-young, I wrote Turing machine in a single line of C

Name: Anonymous 2011-04-06 10:46

>>9
I truly enjoyed your post.

Name: Anonymous 2011-04-06 11:52

>>9

ENTERPRISE QUALITY TROLLING

Name: Anonymous 2011-04-06 12:00

std::map can be slow, lookups are O(log n) in time complexity as it is implemented with a red-black tree or avl tree.

OP should be using std::unordered_map (available in C++11/C++0x--so MSVC++ 2010), or std::tr1::unordered_map (available in TR1--so MSVC++ 2005/2008), or boost::unordered_map. unordered_map has O(n) time complexity for lookups, as it's implemented as an associative hash-map with chained addressing.

It's your own god damn fault OP.

Name: Anonymous 2011-04-06 12:06

>>9,13
Not just that, but I probably wouldn't use a C++ Standard Library template container for that at all. I'd still continue on using a 16x30 C style array in C++ for this because it's the fucking best data structure for the use case. It's a statically-sized array, you don't need any features of a dynamic data structure.

And before some faggot says ``Well, it's not Sepples enough if you don't use C++SL template containers,'' let me state that that is fucking bullshit. C++ is a superset of C. You can still use C style arrays where it fucking makes sense. Don't be a retard and force template containers just so that you can use template containers.

Name: Anonymous 2011-04-06 12:13

>>1 should post the source to his program somewhere so we can laugh at how stupid he is and optimize his sepples code and show him how it is done.

Name: Anonymous 2011-04-06 12:20

>>14
C++ is not a superset of C.

Name: Anonymous 2011-04-06 12:21

C++ should be as fast or faster than C. If it's not, you're doing it wrong.

Name: Anonymous 2011-04-06 12:22

>>16
C++ is a close superset of C, with some minor differences. Don't be an autist.

Name: nambla_dot_org_rules you 2011-04-06 12:34

"C++ is a close superset of C, with some minor differences. Don't be an autist"

Well, I can call main() recursively in C, but not in C++. Would you consider that a minor difference?

Name: Anonymous 2011-04-06 12:39

>>19

You shouldn't be using recursion at all in C++

This is an enterprise grade language, not some toy like your "Lisp"

Name: Anonymous 2011-04-06 12:42

>>20
Your enterprise grade language has toy features like LAMBDAS and GARBAGE COLLECTOR(optional), don't you feel kind of bad about it?

Name: nambla_dot_org_rules you 2011-04-06 12:46

<a bit off topic>
Lisp has a strong garbage collector when compared with the shit that gets implemented in your loser languages like Python and Perl 5.
</a bit off topic

Name: nambla_dot_org_rules you 2011-04-06 12:46

>

Name: Anonymous 2011-04-06 12:47

>>20
Recursion is often necessary for traversing tree data structures, but that's really the only area where recursion should be used in C or C++.

>>19

// test.cpp
int main(int argc, char** argv) {
    return main(argc, argv);
}


1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>  test.cpp
1>d:\development\test\test\test.cpp(8): warning C4717: 'main' : recursive on all control paths, function will cause runtime stack overflow
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


You are doing it wrong. And it should work with GCC, I'm too lazy to reboot into Debian right now.

Name: Anonymous 2011-04-06 12:50

>>24

Why do you have a Japanese locale? You some kind of weeaboo faggot?

Name: Anonymous 2011-04-06 12:51

>>21
It doesn't have a garbage collector per se, the standard does not discuss any constraints about GC--it's implementation defined. Neither GCC, MSVC++, Intel C++, Clang, or any other C++ compiler that I know of has support for GC out of the box. There's a 3rd party Boehm-Demers-Weiser GC library you can plug in and use which overrides operator new and delete, but it doesn't specifically require compiler support, and it doesn't work well with multi-threaded C++ software. In other words, C++ GC is a crutch for Java/C# programmers who are trying to learn C++.

Name: Anonymous 2011-04-06 12:54

>>25

         , -‐ 、, -─-- 、.,_
        ,.i (:::)!       `ヽ,. -、
       ./ ゝ-‐'     _____  !. (::)
     _,./__,,. -‐ ''"´ ̄ ̄`"'' .、`ヽ,ー:'
  ,. ''"´ /´ / ;'  _;'_;'_ !  /!  ;`ヽ,ヽ、
  '.、  .;'   ', i ´ハ_」_/|/ ! メ! ,!ヽ,. ヽ.
    `Y    i Vレ'7´;' ,ハ   レ'_」ソノ., ',   ';
   _ノ     i ,ハ i. '、_ソ    ;',ハY.ノ i   i
   `.>'    (__⊂⊃       '、ソノ!イレ'  ノ             NO!
   ∠._   ノ  | |、    ,.-┐  ⊂!_)‐''"´
     レ'´ヽ、 ! iソ>,、.,,_  _,,. イ |ヽ.
         'ァ|  !>;`ヽ、「、,ハ.|  !ヘ)
         / !  !、::ヽ、.,___ノヽ. !  |
       ,:'  `ヽ! ';::::::::ヽ::`'; 'レヘ!
       / _,,. -‐rァ-、::::::::::r‐''i7ヽ、
      ;' ァ'´   i,/ ̄`ヽ;:::`i、,| !  ';
      !     | !_____,r'::::::::|:::「i  i
      `ヽ.    「!::::::::!|--‐-ゝソ   !
        ,.ヘ   ',ゝ、ノ/:::::i:::::::'、.,__ノ
      /:::/`'';ー--‐'/::::::::!::,o-oヽ.
     く:::::::/:::::/ ,.-r'::::::::::::::;::'ニニヽ::;ゝ

Name: Anonymous 2011-04-06 12:57

>>27
HNNNNNNNNNNGGGGG

Name: Anonymous 2011-04-06 12:58

>>27

>>>/jp/

Reported.

Name: Anonymous 2011-04-06 13:02

>>29
>>>
Back to http://boards.4chan.org/. We have no interthread links, why would we have interboard ones?

Name: Anonymous 2011-04-06 13:08

>>30
>>>/b/

Name: Anonymous 2011-04-06 13:11

>>29,31
Get out. Reported.

Name: Anonymous 2011-04-06 13:17

check em

Name: Anonymous 2011-04-06 13:31

>>33

Nice.

Name: Anonymous 2011-04-06 13:35

>>33
Nice dubs, Xarn.

Name: Anonymous 2011-04-06 13:40

>>35
Nice boat, Makoto.

Name: Anonymous 2011-04-06 14:18

Inline assembly.

It's the only way to be sure.

Name: Anonymous 2011-04-06 15:18

Disgusting.

Name: Anonymous 2011-04-06 17:42

tease.

Name: Anonymous 2011-04-06 19:01

>>36

Nice something, someone.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List