Coolest thing you have ever done in code

Pages: 1234
closed account (NUj6URfi)
I'll take it Cheraphy. Look at my previous posts DTSCode for my Is This Site Legit topic. It has a lot of good info in it including a bootloader.
The minecraft thing is a common thing people do. I'm not going to bother looking it up, but I remember seeing a youtube video where someone was showing of their (16-bit?) processor -- all designed in the video game.


[edit] Don't get me wrong -- It's still cool, though.
Last edited on
Well, the crazy thing is that he's 14, and that he did it on his own. It's unorthodox but really clever for the kid (in my opinion).

I made my own 8-bit ALU in 2010 or so, but I'm a comp sci student who's dabbled in computer architecture before.

edit: we joke in the family that he and I will bring the robot apocolypse. He will build the bots, and I will give them artificial sentience.
Last edited on
for i in $(find ~ -type f) ; do dd bs=1 count=$(stat -c%s "$i") if=/dev/urandom of=$i ; done


Coolest thing I've never done.
Last edited on
Is that for when the RIAA comes knocking at the door?
Last edited on
Now wait, if we get points for degrees of connection I have two acquaintances who have made a popular commercial games :P. Jason Rubin and Ed Boon (Crash Bandicoot and Mortal Kombat, respectively). :P

Can't forget my good friend David Sushil, may not be as big as CB and MK, but has made some games that garnished rewards in the Indie world.
Last edited on by closed account z6A9GNh0
@chrisname,

No, but I had a friend when I was growing up who's dad had a harddrive custom made to fry it's self with a magnet sweep if a password wasn't entered fast enough on boot. I wanted to know why, now, I don't think I want to know why. For legal reasons.
No, but I had a friend when I was growing up who's dad had a harddrive custom made to fry it's self with a magnet sweep if a password wasn't entered fast enough on boot. I wanted to know why, now, I don't think I want to know why. For legal reasons.


That's one thing you have to love about older techies. Now-a-days ( I guess my generation and one or two a bit older) you never see people doing that kind of stuff anymore. Most people won't experiment with a new coolant system let alone something like that.

(I still really want to setup a nitrogen cooled PC someday)
closed account (Dy7SLyTq)
nitrogen cooled

pffft... i want a noz powered computer
1) Purchase freezer
2) Place computer in freezer
3) Run cables from freezer
4) Insulate cable ports
5) ????
6) profit
I've done that to computers that are we installed outdoors, except those freezers were also ovens (we'd program them to swing temperatures from the hottest summer to the coldest winter, and then some). Fun stuff.
closed account (NUj6URfi)
I like that idea Cubbi. Technology wise I built a preamp.

EDIT: I also know how to build a computer.
Last edited on
Cool thread to chime in.

The project I'm most proud of so far is the firmware I've written for a RGB-LED lit Japanese-Style room separator.

Written in assembly for a PIC microcontroller. Software-SPI for a graphic display. Software-I2C for EEPROM, RTC and RGB-Controller. RS232 console for easier debugging and controlling until the display code worked.

The coolest thing about that controller: It has exactly ONE register in the ALU !!!
Instruction set: 35 instructions. THAT'S RISC :))

The code is about 2500 lines long. (Most of that is for the user interface, menus, submenus, ...)

I loved writing that code :D
Last edited on
closed account (Dy7SLyTq)
Cool thread to chime in.
...
I loved writing that code :D


pffft obviously you read that I wrote Hello, world! and felt the need to one up me. youve failed miserably
int main(){} Is the best program I have ever written.
A Tetris clone, written using the SDL library. That's the coolest, finished project made, though.

Obviously DTSCode's 'Hello World' is still a top-contender. I'm not sure how to one-up that.
Well DTSCode may not be joking, I mean if is hello world program looks like andywestken's...


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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
*!
 * Hello world! application
 * 
 * \file hello.cpp
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cassert>

/*!
 * Dispay message.
 */
void displayMessage();

/*!
 * Sentence type
 *
 * Type of sentence, used to decide how to terminate sentence.
 */
enum ESentenceType {
    eStatement,
    eExclamation,
    sQuestion,
    eCommand
};

/*!
 * Utility class to prevent unintended copying of class instances.
 */
class nonCopyable {
protected:
    nonCopyable() {
    }

    ~nonCopyable() {
    }

private:
    nonCopyable(const nonCopyable&);
    const nonCopyable& operator=(const nonCopyable&);
};

/*!
 * Utility function to obtain punctuation mark to end sentence
 * of specified type.
 */
inline char getPunctionMark(ESentenceType sentenceType) {
    char puncMark = '.';
    switch(sentenceType) {
        case eStatement  : puncMark = '.'; break;
        case eExclamation: puncMark = '!'; break;
        case sQuestion   : puncMark = '?'; break;
        case eCommand    : puncMark = '.'; break;
        default: {
            // should never get here
            assert(false);
        }
    }
    return puncMark;
}

/*!
 * Utility class for creation of instances.
 */
template<typename TElem>
class Creatable {
protected:
    Creatable() {
    }

    virtual ~Creatable() {
        clear();
    }

public:
    static TElem* create() {
        TElem* e = new TElem;
        return e;
    }

    void free() {
        delete this;
    }

    virtual void clear() {
    }
};

template<typename TElem, typename TParam>
class CreatableParam {
protected:
    CreatableParam() {
    }

    virtual ~CreatableParam() {
    }

public:
    static TElem* create(TParam p) {
        TElem* e = new TElem;
        e->initialize(p);
        return e;
    }

    void free() {
        finalize();
        delete this;
    }

    virtual void initialize(TParam /*p*/) {
    }

    virtual void finalize() {
        clear();
    }

    virtual void clear() {
    }
};

/*!
 * Base class for displayable content
 */
class DisplayElem
: public nonCopyable {
protected:
    DisplayElem() {
    }

    virtual ~DisplayElem() {
    }

public:
    virtual void display(std::ostream& os) const = 0;
};

/*!
 * STL algorithm for displaying elements
 */
class Displayer
: public std::unary_function<void, const DisplayElem*> {
private:
    std::ostream& m_os;
    char   m_sep;
    size_t m_count;

public:
    Displayer(std::ostream& os, char sep = '\0')
    : m_os(os)
    , m_sep(sep)
    , m_count(0) {
    }

    ~Displayer() {
    }

    void operator()(const DisplayElem* e) {
        if(('\0' != m_sep) && (0 < m_count)) {
            m_os << m_sep;
        }
        e->display(m_os);
        ++m_count;
    }
};

/*!
 * STL algorithm for freeing display elements
 */
template <typename TElem>
class Freer
: public std::unary_function<void, TElem*> {
public:
    void operator()(TElem* e) {
        e->free();
    }
};

/*!
 * Display element for letter.
 *
 * The letter is the fundamental element: it has no substructure.
 */
class Letter
: public DisplayElem
, public CreatableParam<Letter, char> {
private:
    char m_ch;

protected:
    /*virtual*/ ~Letter() {
    }

public:
    Letter() : m_ch('\0') {
    }

    void initialize(char ch) {
        m_ch = ch;
    }

    void finalize() {
        m_ch = '\0';
    }

    void display(std::ostream& os) const {
        os << m_ch;
        // no endLetter()
    }
};

/*!
 * Display element for word.
 *
 * A word is a sequence of letters.
 */
class Word
: public DisplayElem
, public Creatable<Word> {
private:
    std::vector<Letter*> m_letters;

protected:
    /*virtual*/ ~Word() {
        clear();
    }

public:
    Word() {
    }

    void clear() {
        std::for_each(m_letters.begin(), m_letters.end(), Freer<Letter>());
        m_letters.clear();
    }

    void addLetter(Letter* s) {
        m_letters.push_back(s);
    }

    /*virtual*/ void display(std::ostream& os) const {
        std::for_each(m_letters.begin(), m_letters.end(), Displayer(os));
        // no endLetter()
    }
};

/*!
 * Display element for sentence.
 *
 * A sentence is a sequence of words.
 */
class Sentence
: public DisplayElem
, public CreatableParam<Sentence, ESentenceType> {
private:
    std::vector<Word*> m_words;

    ESentenceType m_sentenceType;

protected:
    /*virtual*/ ~Sentence() {
        clear();
    }

    void endSentence(std::ostream& os) const {
        const char puncMark = getPunctionMark(m_sentenceType);
        os << puncMark;
    }

public:
    Sentence()
    : m_sentenceType(eStatement) {
    }

    void initialize(ESentenceType sentenceType) {
        m_sentenceType = sentenceType;
    }

    void finalize() {
        m_sentenceType = eStatement;
    }

    void clear() {
        std::for_each(m_words.begin(), m_words.end(), Freer<Word>());
        m_words.clear();
    }

    void addWord(Word* w) {
        m_words.push_back(w);
    }

    void display(std::ostream& os) const {
        std::for_each(m_words.begin(), m_words.end(), Displayer(os, ' '));
        endSentence(os);
    }
};

/*!
 * Display element for message.
 *
 * A message is a sequence of sentences.
 */
class Message
: public DisplayElem
, public Creatable<Message> {
private:
    std::vector<Sentence*> m_sentences;

protected:
    /*virtual*/ ~Message() {
        clear();
    }

    void endMessage(std::ostream& os) const {
        os << std::endl;
    }

public:
    Message() {
    }

    void clear() {
        std::for_each(m_sentences.begin(), m_sentences.end(), Freer<Sentence>());
        m_sentences.clear();
    }

    void addSentence(Sentence* s) {
        m_sentences.push_back(s);
    }

    void display(std::ostream& os) const {
        std::for_each(m_sentences.begin(), m_sentences.end(), Displayer(os, ' '));
        endMessage(os);
    }
};

/*!
 * Main entrance point.
 */
int main() {
    displayMessage();
    return 0;
}

/*!
 * Display message.
 */
void displayMessage() {
    Word* first_word = Word::create();
    first_word->addLetter(Letter::create('H'));
    first_word->addLetter(Letter::create('e'));
    first_word->addLetter(Letter::create('l'));
    first_word->addLetter(Letter::create('l'));
    first_word->addLetter(Letter::create('o'));

    Word* second_word = Word::create();
    second_word->addLetter(Letter::create('w'));
    second_word->addLetter(Letter::create('o'));
    second_word->addLetter(Letter::create('r'));
    second_word->addLetter(Letter::create('l'));
    second_word->addLetter(Letter::create('d'));

    Sentence* sentence = Sentence::create(eExclamation);
    sentence->addWord(first_word);
    sentence->addWord(second_word);

    Message* message = Message::create();
    message->addSentence(sentence);

    message->display(std::cout);

    message->free();
    // sentences, etc freed by parent
}
Someone had fun creating hello world.
giblit wrote:
Someone had fun creating hello world.
http://www.cplusplus.com/forum/lounge/79437/
http://www.cplusplus.com/forum/lounge/41739/
Strangely, I have the last post on both threads.
Last edited on
giblit wrote:
int main(){} Is the best program I have ever written.

Sorry for nitpicking, but that wouldn't compile. ;)
Pages: 1234