Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 131 132 [133] 134 135 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902540 times)

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1980 on: March 15, 2012, 08:22:26 pm »

these are just quick little programs to solve problems, I named it something short because I had to write it a few times and didn't want to write something longer over and over again, but ya, I need to get into better naming habits.
I won't ever see these programs again, because when I finish I delete it all and start on the next problem using the same Main.cpp file.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1981 on: March 15, 2012, 10:03:40 pm »

these are just quick little programs to solve problems, I named it something short because I had to write it a few times and didn't want to write something longer over and over again, but ya, I need to get into better naming habits.
I won't ever see these programs again, because when I finish I delete it all and start on the next problem using the same Main.cpp file.

What environment are you coding in? A good IDE will save you a lot more typing than short names.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1982 on: March 15, 2012, 10:20:32 pm »

I'm using Code::Blocks

I just got started on problem 11, it looks like a doozy
Spoiler (click to show/hide)
Not a doozy in a hard way, just going to take a little while, also it's my first time working with arrays,
but I've finished the chapter on arrays in my book so I should be more than good.


I have one question though,... why is the plural of Array, arrays ? the plural of cherry isn't cherrys...
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1983 on: March 15, 2012, 10:26:28 pm »

Spoiler (click to show/hide)

Levi

  • Bay Watcher
  • Is a fish.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1984 on: March 15, 2012, 10:40:48 pm »

I have one question though,... why is the plural of Array, arrays ? the plural of cherry isn't cherrys...

Programmers are no good at english.   :P
Logged
Avid Gamer | Goldfish Enthusiast | Canadian | Professional Layabout

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1985 on: March 15, 2012, 10:43:38 pm »

Arraies? Na, that is redonkulas, let's not use words like 'arraies'.

Vactor

  • Bay Watcher
  • ^^ DF 1.0 ^^
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1986 on: March 15, 2012, 10:48:03 pm »

Arrays, because we don't call them cherrays
Logged
Wreck of Theseus: My 2D Roguelite Mech Platformer
http://www.bay12forums.com/smf/index.php?topic=141525.0

My AT-ST spore creature http://www.youtube.com/watch?v=0btwvL9CNlA

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1987 on: March 15, 2012, 10:49:52 pm »

Arrays, because we don't call them cherrays
Well I might start calling them that! What then!?
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1988 on: March 15, 2012, 10:50:59 pm »

Arrays, because we don't call them cherrays
No, but we do call them cherries. The idea is that when a word ends in a 'y', you drop it and ad 'ies' to make it plural. Monopoly? Monopolies!

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1989 on: March 15, 2012, 11:59:26 pm »

Just finished problem 11, it took me far too long

Spoiler (click to show/hide)


I should have written a function to process the array, instead of loading it by hand, would have saved some time...maybe...

« Last Edit: March 16, 2012, 12:13:21 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

kaenneth

  • Bay Watcher
  • Catching fish
    • View Profile
    • Terrible Web Site
Re: if self.isCoder(): post() #Programming Thread
« Reply #1990 on: March 16, 2012, 12:09:40 am »

Spoiler (click to show/hide)

are you sure?

Spoiler (click to show/hide)
Logged
Quote from: Karnewarrior
Jeeze. Any time I want to be sigged I may as well just post in this thread.
Quote from: Darvi
That is an application of trigonometry that never occurred to me.
Quote from: PTTG??
I'm getting cake.
Don't tell anyone that you can see their shadows. If they hear you telling anyone, if you let them know that you know of them, they will get you.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1991 on: March 16, 2012, 12:12:48 am »

Spoiler (click to show/hide)

kaenneth

  • Bay Watcher
  • Catching fish
    • View Profile
    • Terrible Web Site
Re: if self.isCoder(): post() #Programming Thread
« Reply #1992 on: March 16, 2012, 12:15:10 am »

Spoiler (click to show/hide)

Nah, just pad the other dimension with 0's  :P, but good point.
Logged
Quote from: Karnewarrior
Jeeze. Any time I want to be sigged I may as well just post in this thread.
Quote from: Darvi
That is an application of trigonometry that never occurred to me.
Quote from: PTTG??
I'm getting cake.
Don't tell anyone that you can see their shadows. If they hear you telling anyone, if you let them know that you know of them, they will get you.

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1993 on: March 16, 2012, 12:26:12 am »

Arrays, because we don't call them cherrays
No, but we do call them cherries. The idea is that when a word ends in a 'y', you drop it and ad 'ies' to make it plural. Monopoly? Monopolies!

Correct, but only when the letter before the 'y' is a consonant. Hence, monopoly -> monopolies, cherry -> cherries, bay -> bays, array -> arrays.

Just finished problem 11, it took me far too long

Spoiler (click to show/hide)

Quick tip from someone else who does Project Euler: Later on, you'll start encountering problems where the data is given to you as text files. Master file I/O now before you get to them. The header you'll be needing is fstream, with the std::ifstream class for reading and std::ofstream for writing. They work very similarly to std::cin and std::cout.

Why is that, do you ask? Well, std::cin is an object of the std::istream class, of which std::ifstream is a derived class, and std::cout is an object of the std::ostream class, of which std::ofstream is a derived class. The whole std::ios (input/output stream) class hierarchy is pretty crazy.

Spoiler (click to show/hide)
« Last Edit: March 16, 2012, 12:30:18 am by Mego »
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1994 on: March 16, 2012, 01:06:36 am »

I know all about file I/O
used binary file I/O in my game I made :)
well, maybe not ALL about it, but I've used it before and am plenty comfortable with it.
« Last Edit: March 16, 2012, 01:10:22 am by Valid_Dark »
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.
Pages: 1 ... 131 132 [133] 134 135 ... 796