Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover

IL-2 Sturmovik: Cliffs of Dover Latest instalment in the acclaimed IL-2 Sturmovik series from award-winning developer Maddox Games.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 10-16-2011, 02:48 AM
AndyJWest AndyJWest is offline
Approved Member
 
Join Date: Jan 2010
Posts: 1,049
Default

Quote:
to programmers English IS a native language
Really? Here's a random bit of Java (probably with added bugs.. I wrote it)
Quote:
public boolean importCAGraphicLattice(CAEngine engine, File file) {
if (!file.exists() || !file.canRead() || file.isDirectory()) {
showErrorMessage(importTitle, "Unable to read " + file.getName());
return false;
}
try {
image = ImageIO.read(file);
} catch (Exception e) {
showErrorMessage(importTitle, "Error reading " + file.getName() +
":\n" + e);
return false;
}
if (image == null) {
showErrorMessage(importTitle, "File " + file.getName() +
" is not a known graphic format");
return false;
}
System.out.println("File: " + file.getName());
System.out.println("Image: " + image);
int cCols = countImageColors();
System.out.println("Colours: " + cCols);
if(cCols > {
showErrorMessage(importTitle, "File " + file.getName() +
" has too many colours for a valid lattice");
return false;
}
if(cCols > engine.getRule().getNumCellStates()) {
showErrorMessage(importTitle, "File " + file.getName() +
" has too many colours/states for the current rule");
return false;
}
if(!readStateColors(engine.getRule().getNumCellSta tes())){
showErrorMessage(importTitle, "File " + file.getName() +
" does not define colour/state correspondance\n" +
"(see Help for further information)");
// I could add a dialog box to sort out correspondances...
return false;
}
for(int c = 0; c < cCols; c++)
System.out.println("Colour " + c + ": " + stateColors[c]);
try {
int w = image.getWidth();
int h = image.getHeight() - 1; // exclude state color row
engine.setLatticeSize(w, h);
CACursor.setCursor(Cursor.WAIT_CURSOR);
for(int y = 0; y < h; y++)
for(int x = 0; x < w; x++) {
int c = image.getRGB(x, y);
int v = 0;
for(int t = 0; t < cCols; t++)
if(stateColorRGBs[t] == c)
v = t;
engine.setCell(x, y, v);
}
} catch (CAException e) {
CACursor.setDefaultCursor();
showErrorMessage(importTitle, "Error loading " + file.getName() +
":\n" + e);
return false;
}
CACursor.setDefaultCursor();
return true;
}
How many non-programmer English-speakers would consider that to be written in English? I've used vaguely-English names for variables, methods etc, but I could just have easily used any language compatible with the recognised character set for the language. Arbitrary labels are just that - arbitrary. And programming 'languages' aren't languages in the normal sense at all, any more than '6 x 7 = 42' or 'R = S/C+V' is.

EDIT: - just to clarify, the smiley character isn't normally used in Java, and I do actually indent code when I write it - the formatting seems to have got slightly screwed up when I pasted it here...
__________________
MoBo: Asus Sabertooth X58. CPU: Intel i7 950 Quad Core 3.06Ghz overclocked to 3.80Ghz. RAM: 12 GB Corsair DDR3 (1600).
GPU: XFX 6970 2GB. PSU: 1000W Corsair. SSD: 128 GB. HDD:1 TB SATA 2.
OS: Win 7 Home Premium 64bit. Case: Antec Three Hundred. Monitor: 24" Samsung.
Head tracking: TrackIR 5. Sore neck: See previous.

Last edited by AndyJWest; 10-16-2011 at 02:53 AM. Reason: clarify that smiley's aren't recognised Java source!
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:29 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.