Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
jonnii
Dec 29, 2002
god dances in the face of the jews
I'm sure this has been mentioned a million times, but I see this EVERY day and it winds me up.

code:
if(some_variable == true){
   ...
}

Adbot
ADBOT LOVES YOU

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Why does it wind you up? Because some_variable evaluates to true?

Aren't there programming languages that only accept the boolean data type instead of a free form expression? If it was a language like that then that sort of construction would be necessary.

POKEMAN SAM
Jul 8, 2004

jonnii posted:

I'm sure this has been mentioned a million times, but I see this EVERY day and it winds me up.

code:
if(some_variable == true){
   ...
}

I do it because it makes my code look cleaner. I usually don't use == true for if statements whose conditions are method calls, provided that the method has a meaningful name.

I'll do, for example, if (m_isOpening == true) { }

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
I just ran into a class that has a member variable boolean m_immutable;

In every loving mutator function, it tests this, and if it's true, it just returns. For example:

code:
public void setCostMod(double v) {
	if (m_immutable) {
		return;
	}
	m_costMod = v;
}
gently caress me.

Standish
May 21, 2001

Triple Tech posted:

Why does it wind you up? Because some_variable evaluates to true?
Because it's needlessly verbose and also because "some_variable" can evaluate to true while "some_variable == true" evaluates to false e.g.
code:
int i = 42;
if (i)
{
   ... // code gets run
}
if (i == true)
{
   ... // code does not get run
}

Evis
Feb 28, 2007
Flying Spaghetti Monster

Standish posted:

Because it's needlessly verbose and also because "some_variable" can evaluate to true while "some_variable == true" evaluates to false.

That's pretty cool. I take it that it would have to be a type conversion or something? Could you post an example?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Evis posted:

That's pretty cool. I take it that it would have to be a type conversion or something? Could you post an example?

It's just the way languages like C handle their if statements. Java specifically decided to not allow it to work that way because of the specter of "ambiguity".

zootm
Aug 8, 2006

We used to be better friends.

Standish posted:

Because it's needlessly verbose and also because "some_variable" can evaluate to true while "some_variable == true" evaluates to false e.g.
code:
int i = 42;
if (i)
{
   ... // code gets run
}
if (i == true)
{
   ... // code does not get run
}
In some languages where this is possible, there are good, concrete reasons why you would want to do this.

TRex EaterofCars posted:

It's just the way languages like C handle their if statements. Java specifically decided to not allow it to work that way because of the specter of "ambiguity".
Considering that C doesn't (or didn't, until C99) have a "true" boolean type, the "== true" thing is kinda meaningless there.

zootm fucked around with this message at 22:07 on Jun 20, 2008

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.
See how many problems you can spot here:


code:
class WrapperClass
{
public:
  WrapperClass();
  bool AllocateStuff();
  ...
private:
  int err;
  bool mInitialize;
  ...
};

WrapperClass::WrapperClass() : err(0), mInitialize(false)
{
}

bool WrapperClass::AllocateStuff()
{
  bool lsuccess = false;

  SomeObject o1 = objAlloc(params, &err);
  lsuccess = err;

  SomeObject o2 = objAlloc(params, &err);
  lsuccess = err;

  ...

  lsuccess = mInitialize;
  return lsuccess;
}
There are several function using the same pattern. "err" is never used outside these functions.

JoeNotCharles fucked around with this message at 22:10 on Jun 20, 2008

HIERARCHY OF WEEDZ
Aug 1, 2005

code:
		public DataSet Inquiry(
			string p_strStatus,
			string p_strType,
			string p_strWODate1,
			string p_strWODate2,
			string p_strCDate1,
			string p_strCDate2,
			string p_strWOPerfDate1,
			string p_strWOPerfDate2,
			string p_strStaffId,
			string p_strReq,
			string p_strANo,
			string p_strAType,
			string p_strWOLoc,
			string p_strVendor,
			string p_strComp,
			string p_strBDept,
			string p_strSProb,
			string p_strWPerf,
			string p_strADept,
			string p_strPType,
			string p_strTag,
			string p_strPriority1,
			string p_strPriority2,
			string p_strRisk1,
			string p_strRisk2,
			string p_strSchedule,
			string p_strALoc,
			string p_strTemp,
			string p_strWOStaff,
			string p_strTrade,
			int	   p_intReportType,
			int	   p_intView_others,
			string p_strSort,
			string p_strStaff,
			string p_strFacility,
			string p_strType_service,
			out int p_intRecordCount) 
		{ //...
Kill me.

Evis
Feb 28, 2007
Flying Spaghetti Monster

TRex EaterofCars posted:

It's just the way languages like C handle their if statements. Java specifically decided to not allow it to work that way because of the specter of "ambiguity".

I guess I missed this aspect of C since I've almost exclusively worked in C++. http://en.wikipedia.org/wiki/Boolean_datatype has even more information on it.

To JoeNotCharles: based on the code I can see, WrapperClass::AllocateStuff() always returns false. Even without that, an error in the first objAlloc call would never be seen. There's also a memory leak if AllocateStuff is called twice.

Edit: this really depends on what objAlloc does I guess.

floWenoL
Oct 23, 2002

Evis posted:

I guess I missed this aspect of C since I've almost exclusively worked in C++. http://en.wikipedia.org/wiki/Boolean_datatype has even more information on it.

C++ is not immune to this.

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

Evis posted:

To JoeNotCharles: based on the code I can see, WrapperClass::AllocateStuff() always returns false. Even without that, an error in the first objAlloc call would never be seen. There's also a memory leak if AllocateStuff is called twice.

Edit: this really depends on what objAlloc does I guess.

Oops, I forgot to add "if (mInitialize) return false;" at the beginning. Which would take care of the memory leak, if it worked.

So you can add:

- mInitialize never gets set to anything
- there's no reason for "err" to be a class member, since it's never used except to set lsuccess
- if you're using a bool for an error code, true should mean success, not false (meaning lsuccess is misnamed)
- either it should be cleaning up an aborting after each error, or there should be a comment explaining why it doesn' t do this

Evis
Feb 28, 2007
Flying Spaghetti Monster

floWenoL posted:

C++ is not immune to this.

Not if they're implementing bool in the same way it was done in C, but if you're using the builtin type is it still potentially a problem? I could see weirdness if there was an order of operations issue that the coder wasn't aware of. I suppose if you were doing some more explicit manipulation of memory you could run into something weird too. (I'm not really advocating using ==true, I'm really just interested in learning more about the issue)

more falafel please
Feb 26, 2005

forums poster

Evis posted:

Not if they're implementing bool in the same way it was done in C, but if you're using the builtin type is it still potentially a problem? I could see weirdness if there was an order of operations issue that the coder wasn't aware of. I suppose if you were doing some more explicit manipulation of memory you could run into something weird too. (I'm not really advocating using ==true, I'm really just interested in learning more about the issue)

What are you talking about

POKEMAN SAM
Jul 8, 2004

floWenoL posted:

C++ is not immune to this.

Especially when you use

#define bool int


:mad:

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:
I just came upon this. There are about 20 different variations for different properties, all almost identical, only the property names and default values differ.
code:
if (config["someProperty"] != null && config["someProperty"].Trim() != "")
{
    someProperty = config["someProperty"];
}
else
{
    someProperty = "defaultValue";
}

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...

dwazegek posted:

I just came upon this. There are about 20 different variations for different properties, all almost identical, only the property names and default values differ.
code:
if (config["someProperty"] != null && config["someProperty"].Trim() != "")
{
    someProperty = config["someProperty"];
}
else
{
    someProperty = "defaultValue";
}

I actually wrote a String C# extension method to do something like this. But I think it was String.NullOrEmpty() or something.

essdeesee
Mar 18, 2007

I've got illegals in my bottom :unsmith:
So we picked up a contract to do some work for a church organisation. Part of their donation system had this gem in it:

code:
$SQL = "SELECT * FROM Admin WHERE username = '". $username ."' AND password = '". $password ."' ";
			
$rsAdmin = mysql_query($SQL);

if (sizeof($rsAdmin) > 0) {
...create sessions (with username and password in plain text)
}
There is nothing right with this..

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

Ryouga Inverse posted:

I actually wrote a String C# extension method to do something like this. But I think it was String.NullOrEmpty() or something.

That's not that bad, it's actually pretty understandable.

The horror from that snippet is that he's copy/pasted the same 8 identical lines of code 20 times instead of just sticking it in a method and calling that method multiple times (which would drop the length of the method from ~170 lines to ~30). He's also doing the same look up every time he needs the value, instead of just doing it once and reusing that result.

Another horror that can't be seen from that snippet is that the entire operation is completely wrong. If the key doesn't exist the dictionary will throw an exception, it won't return null. And if it does return null or an empty string, then it's because that's the value that has been entered, probably for a reason.

The correct method would be something like:

code:
private static string GetProperty(IDictionary<string, string> dict, string propertyName, string defaultValue)
{
   string value;
   return dict.TryGetValue(propertyName, out value) ? value : defaultValue;
}

RegonaldPointdexter
Mar 13, 2006

Hey guys what's going on?

dwazegek posted:

dict.TryGetValue

I just learned something new. Thanks.

Victor
Jun 18, 2004

dwazegek posted:

If the key doesn't exist the dictionary will throw an exception, it won't return null.
Note if it is a NameValueCollection:

NameValueCollection.Item Property posted:

This property returns a null reference (Nothing in Visual Basic) in the following cases: 1) if the specified key is not found; and 2) if the specified key is found and its associated value is a null reference (Nothing in Visual Basic). This property does not distinguish between the two cases.
I learned something new: NameValueCollections allow .Add to be called multiple times with the same key, in which case a comma-delimited list is returned upon accessing that key.

Entheogen
Aug 30, 2004

by Fragmaster
this is kinda lengthy but bear with me.

So here is 250-point Division 2 problem from TopCoder SRM

topcoder posted:

Problem Statement for HappyCells
Problem Statement
Consider a rectangular grid of cells that is given by a String[] grid. A cell marked with a 'X' character denotes an occupied cell, and a cell marked with a '.' character denotes an empty cell. We say that two cells are orthogonal neighbors if they share a common side, and they are diagonal neighbors if they are adjacent to one another diagonally.



We say that a cell is 1-happy if the cell is empty and all of the cell's orthogonal and diagonal neighbors are occupied (note that a cell may have fewer than 8 neighbors). A cell is 2-happy if the cell is empty and all of the cell's orthogonal neighbors are occupied, but one or more of its diagonal neighbors are empty. A cell is 3-happy if the cell is empty and all of the cell's diagonal neighbors are occupied, but one or more of its orthogonal neighbors are empty.



Return a int[] with 3 elements. The first element should be the number of 1-happy cells, the second element should be the number of 2-happy cells, and the third element should be the number of 3-happy cells.

Definition

Class: HappyCells
Method: getHappy
Parameters: String[]
Returns: int[]
Method signature: int[] getHappy(String[] grid)
(be sure your method is public)


Constraints
- grid will contain between 1 and 50 elements, inclusive.
- Each element of grid will contain between 1 and 50 characters, inclusive.
- Each element of grid will contain the same number of characters.
- Each character in grid will be either an uppercase 'X' or '.'

Examples
0)


{
"XXX",
"X.X",
"XXX"
}

Returns: {1, 0, 0 }

The center cell is 1-happy.
1)


{"."}

Returns: {1, 0, 0 }

Note that even though this cell has no neighbors, it is 1-happy because there are no neighbors to be empty.
2)


{
"XXXXXX",
"X.XXXX",
"XXX.XX",
"X..XXX",
"XXXXXX"
}

Returns: {1, 1, 1 }

The uppermost empty cell is 1-happy, the empty cell on the third row is 2-happy, and the left cell on the fourth row is 3-happy. Note that the right cell on the fourth row is not happy because it has both diagonal and orthogonal neighbors that are empty.
3)


{"..."}

Returns: {0, 0, 3 }

and this is someone's solution:

code:
class HappyCells {
public:
  vector <int> getHappy(vector <string>);
};
 
vector <int> HappyCells::getHappy(vector <string> grid) {
  int i,j;
  vector<int>r(3,0);
  
  if(grid.size()==1 && grid[0].size()==1)
    if(grid[0][0] == '.'){ r[0]++; return r;}
  
  if(grid.size()==1 && grid[0].size()>1){
    for(i=0;i<grid[0].size();i++){
      if(grid[0][i] != 'X' && (i>0 || i<grid[0].size()-1))
        if(grid[0][i-1] != 'X' || grid[0][i+1] != 'X')
          r[2]++;
      else if(grid[0][i] != 'X' && i==0)
        if(grid[0][i+1] != 'X')
          r[2]++;
      else if(grid[0][i] != 'X'  && i==grid[0].size()-1)
        if(grid[0][i-1] != 'X')
          r[2]++;
    }
    return r;
  }
  if(grid.size()>1 && grid[0].size()==1){
    for(i=0;i<grid.size();i++){
      if(grid[i][0] != 'X' && i>0 || i<grid[0].size()-1)
        if(grid[i-1][0] != 'X' || grid[i+1][0] != 'X')
          r[2]++;
      else if(grid[i][0] != 'X' && i==0)
        if(grid[i+1][0] != 'X')
          r[2]++;
      else if(grid[i][0] != 'X'  && i==grid[0].size()-1)
        if(grid[i-1][0]!= 'X')
          r[2]++;
    }
    return r;
  }
  
    
    
  
  for(i=0;i<grid.size();i++){
    for(j=0;j<grid[i].size();j++){
      if(grid[i][j] != 'X'){
        if(j>0&&j<grid[i].size()-1){
          if(i>0&&i<grid.size()-1){
            if(grid[i-1][j-1] != 'X' || grid[i-1][j+1] != 'X' || grid[i+1][j-1] != 'X' || grid[i+1][j+1] != 'X')
              if(grid[i][j] == '.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i][j+1] != 'X' || grid[i-1][j] != 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==0){
            if(grid[i+1][j-1] != 'X' || grid[i+1][j+1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i][j+1] != 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==grid.size()-1){
            if(grid[i-1][j-1] != 'X' || grid[i-1][j+1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i][j+1] != 'X' || grid[i-1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
        }
        else if(j==0){
          if(i>0&&i<grid.size()-1){
            if(grid[i-1][j+1] != 'X' || grid[i+1][j+1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j+1] != 'X' || grid[i-1][j] != 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==0){
            if(grid[i+1][j+1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j+1]!= 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==grid.size()-1){
            if(grid[i-1][j+1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j+1] != 'X' || grid[i-1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
        }
        else if(j == grid[i].size()-1){
          if(i>0&&i<grid.size()-1){
            if(grid[i-1][j-1] != 'X' || grid[i+1][j-1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i-1][j] != 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==0){
            if(grid[i+1][j-1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i+1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
          else if(i==grid.size()-1){
            if(grid[i-1][j-1] != 'X')
 
              if(grid[i][j] =='.') grid[i][j]='2';
              else if(grid[i][j] == '2') grid[i][j] = '2';
              else if(grid[i][j] == '3') grid[i][j] = '4';
              else if(grid[i][j] == '4') continue;
            if(grid[i][j-1] != 'X' || grid[i-1][j] != 'X')  
 
              if(grid[i][j] =='.') grid[i][j]='3';
              else if(grid[i][j] == '2') grid[i][j] = '4';
              else if(grid[i][j] == '3') grid[i][j] = '3';
              else if(grid[i][j] == '4') continue;
          }
        }
      }
    }
  }
  
  for(i=0;i<grid.size();i++){
    for(j=0;j<grid[i].size();j++){
      if(grid[i][j] == '.') r[0]++;
      if(grid[i][j] == '2') r[1]++;
      if(grid[i][j] == '3') r[2]++;
    }
  }
  
  return r;
      
}
He recieved 75/250 points for it (meaning it took him about an hour), and failed the system test. :)

Sivart13
May 18, 2003
I have neglected to come up with a clever title

Entheogen posted:

So here is 250-point Division 2 problem from TopCoder SRM
I wrote a Conway's game of life implementation in High School that looked like that and I was so proud I printed out the source and carried it around with me.

Entheogen
Aug 30, 2004

by Fragmaster

Sivart13 posted:

I wrote a Conway's game of life implementation in High School that looked like that and I was so proud I printed out the source and carried it around with me.

how long did it take you to do it?

Incoherence
May 22, 2004

POYO AND TEAR

Entheogen posted:

this is kinda lengthy but bear with me.

So here is 250-point Division 2 problem from TopCoder SRM
Programming contest solutions tend not to be known for their elegance.

Entheogen
Aug 30, 2004

by Fragmaster

Incoherence posted:

Programming contest solutions tend not to be known for their elegance.

elegance has nothing to do with this. More like super-retarded brute-force approach that is not even really brute force, just brute brain :D

ohgodwhat
Aug 6, 2005

Incoherence posted:

Programming contest solutions tend not to be known for their elegance.

I've seen some elegant solutions at programming competitions:

code:
for(int i=1; i<1000; i++)
if(i==1){ printf("One");}
if(i==2){ printf("Two");}
if(i==3){ printf("Three");}
....
if(i==999){ printf("Nine Hundred And Ninety Nine");}
}
Took a team the entire length of the competition to write (6 hours), and it didn't even pass.

Sivart13
May 18, 2003
I have neglected to come up with a clever title

Entheogen posted:

how long did it take you to do it?
A hell of a lot longer than an hour. But it also had the benefit of working.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
One of my earliest programs was Tic-Tac-Toe. I never finished it because it was taking too long to code all of the possibilities.

ryanmfw posted:

Took a team the entire length of the competition to write (6 hours), and it didn't even pass.
I was actually in a competition and we did that problem the right way. A team which did it the brute-force way won because ours was the only other one that actually worked, but we spelled "forty" wrong so we lost. They told us that it was incorrect and if we were programmers at, say, Microsoft, they wouldn't have allowed that to ship because of it. :suicide:

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock

OneEightHundred posted:

I was actually in a competition and we did that problem the right way. A team which did it the brute-force way won because ours was the only other one that actually worked, but we spelled "forty" wrong so we lost. They told us that it was incorrect and if we were programmers at, say, Microsoft, they wouldn't have allowed that to ship because of it. :suicide:

Don't most competitions have judge systems that demands a specific input? At least those I've participated in have been like that. Which can be pretty annoying if you're one space character off, but it seems better than the alternative you experienced.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Yes, outputting incorrect output was an automatic fail. I just find it very humorous that they failed us and suggested Microsoft would rather have programmers with immaculate spelling ability than ones that write non-terrible code.

Entheogen
Aug 30, 2004

by Fragmaster

OneEightHundred posted:

Yes, outputting incorrect output was an automatic fail. I just find it very humorous that they failed us and suggested Microsoft would rather have programmers with immaculate spelling ability than ones that write non-terrible code.

who hosted that competition? Also did they look at source code before doing their recommendations?

As much as it is easy to make fun of Micro$oft, I highly doubt that it hires people like this to do any serious programing for them.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Entheogen posted:

who hosted that competition? Also did they look at source code before doing their recommendations?
I don't remember who hosted it, I was in 8th grade at the time. It was some competition from several high schools from across the county.

They did look at the source, the quality of the source was what the ratings were based on, but incorrect output was an automatic fail. In this case, "fourty" instead of "forty" failed, and the only team left got the right output with some copy-pasted abomination.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
Programming competitions should be viewed as nerd social events and really not much else, for exactly the reasons outlined here.

ohgodwhat
Aug 6, 2005

OneEightHundred posted:

One of my earliest programs was Tic-Tac-Toe. I never finished it because it was taking too long to code all of the possibilities.

I was actually in a competition and we did that problem the right way. A team which did it the brute-force way won because ours was the only other one that actually worked, but we spelled "forty" wrong so we lost. They told us that it was incorrect and if we were programmers at, say, Microsoft, they wouldn't have allowed that to ship because of it. :suicide:

That's actually pretty funny because I misspelled "forty" as well which led to the same problem. We didn't get that stupid bullshit about MS though. Those competitions were so pathetic. We beat the second place team by 50% the first year. One retarded group gave up an hour into it and played a flash based version of DDR.

quote:

Programming competitions should be viewed as nerd social events and really not much else, for exactly the reasons outlined here.

Minus the social part, yeah. I didn't go to them to meet people. It was a lot more fun crushing their hopes and dreams....

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
I still do the ACM competitions at my school and usually score in the top 5. I still dream that next year I'll make it to the Nationals.

CT2049
Jul 24, 2007
I go to the ACM programming competitions mainly for the free food, soda, and entertainment. Watching an underclassman refuse help, get angry, demand that he get to use the submittal computer whenever he wants, and turn his code into a pile of crap is a good day in my book.

Entheogen
Aug 30, 2004

by Fragmaster

MEAT TREAT posted:

I still do the ACM competitions at my school and usually score in the top 5. I still dream that next year I'll make it to the Nationals.

I went to nationals with my school and we sucked so bad it was really embarrassing. We didn't solve a single problem correctly in 6 hours :(

ACM is hardcore.

Adbot
ADBOT LOVES YOU

Evis
Feb 28, 2007
Flying Spaghetti Monster

more falafel please posted:

What are you talking about

I was actually running under the assumption that the code above written in C++ would work. I'm an idiot.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply