Coolest thing you have ever done in code

Pages: 1234
Cheraphy wrote:
How do you set starting line number in code tags? O:
[code firstline=42]/*code that spans
more than one line*/[/code]
42
43
/*code that spans
more than one line*/


The highest line number you can use is this:
9223372036854775805
9223372036854775806
/*a few numbers below
2 to the 63rd power*/
Last edited on
What happens if you go beyond that? I'm too scared to find out.
 
//derp 




^that apparently.
Last edited on
/*nothing much, just
lacks line numbers*/
Last edited on
Holy crap!




That's a lot of lines!
That's a lot of lines!


Hopefully it's not all in main()
The coolest thing I ever wrote in code was probably also the worst thing I ever wrote. It was a 2D tile-based RPG written in QBasic on an old Windows 3.1 386 laptop. Everything from graphics to NPC behavior and dialogues were hard-coded and brute forced to work the way I wanted. I didn't get very far because the code got massive and confusing very quickly. But I think it was cool that I created a "working" game with very little programming experience and 0 game programming experience.

Now that I think about it, it probably wasn't as cool as I remember... :(
Last edited on
I once made a Simulator for a game I played, to predict the possible outcomes of a fight (win/loss, injuries, etc). Rose through the ranks pretty quickly by being able to take bigger risks because I knew the odds were in my favor, compared to others who would only do "certain win" fights for a lower reward (or take too much risk).
cbpon = custom battle plan on
foa = full out attack
sneak = sneak attack

The program worked when I tested it.
@toad

Well at least put those in as comments, better to have a more descriptive variable name though.

toad1359 wrote:
The program worked when I tested it.


That is a very different thing to the program being as elegant as it could be, or well written, or utilising good practice.

For example, someone might write 200 LOC in BrainF@#k, that prints "Hello World". Perhaps that is an extreme example, but I am just trying to point out ways you can improve your code.

Not sure whether I mentioned style guide to you before, but here are two:

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Inline_Functions
http://www.stroustrup.com/JSF-AV-rules.pdf


To me, the ability for others to understand one's code is a big thing. Simplicity, clarity, good practice & efficiency all aid that idea.
I had one computer architecture class where I used assembly to create small programs for a little development board with some peripheral attachments. You could hook up a 12-key pad to the board, control a panel of four seven-segment displays, or drive motors connected to the board. It was the only time I'd ever gone past the compiler curtain and worked directly with assembly. There was something extremely cool and fascinating about having to work so closely to the computer, being responsible for the registers, pushing and popping the stack manually, and stuffing as much data into a word as possible. It made me appreciate all the things I get to take for granted when working in higher-level languages.
@booradley60 you know assembly?
@toad1359

Ha, not even close. This was one class I took 6 or 7 years ago. The computer we used in our labs had a simplified instruction set (I've never written x86 assembly), and that was the only time I've ever used it. But the experience was wonderful. I think my favorite part was the excruciating attention to detail needed to get the program to work correctly. Writing software for the little dev board felt so... satisfyingly deterministic, if that makes sense.
Last edited on
Darn it.
closed account (Dy7SLyTq)
speaking of assemby, anyone know what the best nasm guide is? im writing a bootloader and while i can understand the code, i cant write in it, which i would very much like to do, so i can make edits
I think everything I ever coded is cool. Though, I don't consider them cool enough to bother mentioning here.
Well you should post them anyway.
Lumpkin wrote:
Well you should post them anyway.

Never going to happen.
My 14 year old brother made a 4 bit adder and subtractor in minecraft that worked in base16 and used pistons and the fact that redstone has a max length of 16 blocks. Looked nothing up, used notes on logic gates I gave him when he was 10 or so. Kids a genius, I swear.

(does that count?)
Yeah, for your 14 year old brother. What so what is the coolest thing you have done? :P
Pages: 1234