写出更好的程序? [英] Writing better program?

查看:88
本文介绍了写出更好的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展另一个游戏项目,它正在进行中。与我之前编写的版本相比,这是一个改进的
改进版。我正在努力编写好的b
更好的程序,并且经常想知道如何在编程方面做得更好。我ñ
倾向于学习什么是有用的并完成工作。如果有一些我不知道的技术,我总是很好奇。我读书和学习

以及编写程序。我的目标是有一天能够找到一份工作

编程。我有学位而不是编程。我在编写程序和一些在线资源方面有相当多的经验。我试图用人们可能实际想要的程序来赚取b $ b。我不认为这是可能的,或者我可以或任何人可以写他们的专业软件

selvs。


我正在努力找到那些有编程工作的人。

看看我在做什么并批评我的工作。我自己做了大量的工作,但我的经历有限。我真的可以使用

的想法来改善我的项目。我想知道我的工作如何
堆积起来。

I am working on another game project and it is comming along. It is an
improvment over a previous version I wrote. I am trying to write
better programs and often wonder how to get better at programming. I
tend to learn what is useful and gets the job done. I am always
curious if there is some techique I don''t know. I read books and study
as well as write programs. My goal is to some day be able to get a job
programming. I have a degree but not in programming. I have quite a
bit of experience in writing programms and some on-line cources. I am
trying to wite programs people might actualy want. I don''t think it is
possible I could or any one could write profetional software by them
selvs.

I am trying to find those of you out there who have programming jobs to
look at what I am doing and criticize my work. I do a great deal of
work myself but there are limits to my experience. I realy could use
ideas to make my projects better. I would like to know how my work
stacks up.

推荐答案

你好JoeC,

你有网站吗?如果你在网上发布你的程序并使它们可以下载,那么人们可以看到你提供的东西。


此外,什么样的技术是什么你用的?你在写C ++ / Java

程序吗?你使用.NET吗?


祝你找到编程工作好运!

Hi JoeC,

Do you have a website? If you post your programs online and make them
available to download, then people can see what you have to offer.

Also, what sort of technology are you using? Are you writing C++/Java
programs? Do you use .NET?

I wish you luck in finding a programming job!



Steve Chamberlain写道:

Steve Chamberlain wrote:

你好JoeC,


你有网站吗?如果你在网上发布你的程序并使它们可以下载,那么人们可以看到你提供的东西。


此外,什么样的技术是什么你用的?你在写C ++ / Java

程序吗?你使用.NET吗?


祝你找到编程工作好运!
Hi JoeC,

Do you have a website? If you post your programs online and make them
available to download, then people can see what you have to offer.

Also, what sort of technology are you using? Are you writing C++/Java
programs? Do you use .NET?

I wish you luck in finding a programming job!

http://www.planetsourcecode.com/vb/s...1=Quick+Search

http://www.planetsourcecode.com/vb/s...1=Quick+Search


JoeC写道:
JoeC wrote:

Steve Chamberlain写道:
Steve Chamberlain wrote:

>>你好JoeC,

你有网站吗?如果您在线发布您的程序并使其可供下载,那么人们可以看到您提供的内容。

此外,您使用的是哪种技术?你在写C ++ / Java
程序吗?你使用.NET吗?

祝你找到编程工作好运!
>>Hi JoeC,

Do you have a website? If you post your programs online and make them
available to download, then people can see what you have to offer.

Also, what sort of technology are you using? Are you writing C++/Java
programs? Do you use .NET?

I wish you luck in finding a programming job!


http://www.planetsourcecode.com/vb/s...1=Quick+搜索



我一般认为使用命名空间std;是一个坏主意。

使用命名空间std;在标题中是一个非常糟糕的主意。


buf应该是某种智能指针,并且要小心

你在哪里制作它,以及如何你使用它。


你的代码散布着神奇的数字。这应该避免。并且

记住,在C ++中,char实际上是一个整体类型。


当我运行时,所有的动作都会导致代码崩溃。


您应该考虑添加一个功能,将两个电线加在一起

。喜欢:


Coord算子+(const Coord& c1,const Coord& c2);


Coord应该有一个默认的ctor。特别是因为你正在使用

默认值来控制板子中的coord ::


也许,coord应该有ctor看起来像这个:

coord :: coord(const int& xx,const int& yy):x(xx),y(yy){}


另外,你可能想要考虑这样的事情:

bool board :: validCoordForSpaces(const Coord& c)const {

const bool result =(0< ; = cx&& cx< size)&& (0< = cy&& cy<

尺寸);

返回结果;

}


但我倾向于认为班级板可能已经做得太多了。对于

的例子,我不清楚为什么你在
板上有数据成员e,n,s,w。想想你的董事会如何编写,也许

考虑添加这样的枚举:

enum方向{NORTH,SOUTH,EAST,WEST}

和地图如:

std :: map< Direction,coordkeys;

那么你可以:

键[NORTH] = coord(0,-1);


(当然,有一些关于北方或北方的辩论将是

更好,你会必须选择你认为最好的东西。)


想想这段代码片段和你的board :: move方法。


const int arraySize = 10;

int a [arraySize];

if(a [103] == 0){SomeErrorMessage("哎呀不能检查)那个指数。); }

如果你提供了一个你编写的代码的参考,希望人们会看到它,那么编译代码最好。

另外,我仍然认为你咬的更多,那么你可以在这一点上合理地咀嚼
。我想你会更好地尝试一些更简单的程序来建立你的游戏。


祝你好运。

LR

I generally think that using namespace std; is a bad idea.
Putting using namespace std; in a header is a very bad idea.

buf should probably be some kind of smart pointer, and be careful about
where you make it, and how you use it.

Your code is scattered with magic numbers. This should be avoided. And
remember that in C++, a char is really an integral type.

When I run, all the moves cause the code to crash.

You ought to think about adding a function that adds two coords
together. Like:

Coord operator+(const Coord &c1, const Coord &c2);

Coord should have a default ctor. Particularly as you''re using the
default value for a coord in board::move.

And maybe also, coord should have ctor that looks like this:
coord::coord(const int &xx, const int &yy) : x(xx), y(yy) {}

Also, you might want to think about something like this:
bool board::validCoordForSpaces(const Coord &c) const {
const bool result = (0 <= c.x && c.x < size) && (0 <= c.y && c.y <
size);
return result;
}

But I tend to think that class board might already do too much. For
example, it''s not clear to my why you have data members e,n,s,w in
board. Think about how your ctor for board is written, and perhaps
consider adding an enum like this:
enum Direction { NORTH, SOUTH, EAST, WEST }
and a map like:
std::map<Direction, coordkeys;
then you can:
keys[NORTH] = coord(0,-1);

(Of course, there is some debate as to NORTH or North would be
preferable, you''ll have to choose what you think is best.)


Think about this code snippet and your board::move method.

const int arraySize = 10;
int a[arraySize];
if( a[103] == 0 ) { SomeErrorMessage("Oops can''t check that index."); }
If you offer a reference to code that you''ve written in the hopes that
people will look at it, it would be best for that code to compile.
Also, I still have the opinion that you are biting off more then you can
reasonably chew at this point. I think you''d do better to try some
simpler programs and build up to your game.

Good luck.

LR


这篇关于写出更好的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆