对新项目的建议 - 两台 Ubuntu 机器之间的命令行国际象棋游戏
我是一名计算机科学学生,我很想制作一个命令行国际象棋游戏。理想情况下,我能够直接将我的动作 ping 给我的对手,只是为了好玩,我宁愿使用 ASCII 艺术在命令行打印棋盘(无记忆象棋)。
我拥有 4 年计算机科学学位,并且刚刚开始担任 Java 程序员。我想回到基础知识来找点乐子,但我不知道如何开始。
您将建立什么样的联系以及如何建立?你会使用什么语言以及你认为这个项目最困难的事情是什么。
2台linux机器在同一网络上,我可以轻松地ping机器。
干杯,
Gav
编辑
我对可能的方法有什么想法? 我可以轻松地用 Java 完成它,也许这对我来说是最好的选择。制作一个可执行 Jar 并从命令行运行它。我只是希望通过脚本语言或类似语言学习新语言或技能。例如,我只是不知道如何在 Python 中设置连接。
抱歉,我知道这个问题有点模糊,但我只是在寻找一些指示,没有任何深入的内容。你会使用什么技术。
I am a CS student and I'd love to make a command line chess game. Ideally I would be able to ping my moves directly to my opponent and just for fun I would rather use ASCII art to print the board (No memory chess) at the command line.
I have a 4 year computer science degree under my belt and I'm just starting work as a Java programmer. I want to go back to basics for a bit of fun but I'm stumped on how to start.
What kind of a connection would you establish and how? What language would you use and what would be the most difficult thing about this project in your opinion.
2 linux machines on the same network, I can ping the machine easy.
Cheers,
Gav
EDIT
What thoughts do I have on a possible approach?
I could do it in Java easily and maybe that's the best option for me. Make an executable Jar and run it from the command line. I was just hoping to learn a new language or skill with a scripting language or similar. I just don't know anything about setting up a connection in Python for example.
Sorry, I know the question was a bit vague but I was just looking for a couple of pointers, nothing in depth. What technology would you use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我用Java做了一个命令行国际象棋游戏。不过我还没有实现在线模式。但 Java 可能是最好使用的语言。
I have done a command line chess game using Java. However I have not implemented an online mode. But Java would probably be the best language to use.
我为我的在线国际象棋网站做了类似的事情:www.geekswithchess.com。
我使用客户端服务器架构用 C# 实现了我的国际象棋系统。我使用 Microsoft Silverlight 作为客户端,使用 Windows Communication Foundation (WCF) 服务作为服务器。
您可以与客户进行设计,但每个客户都必须保留自己的信息,例如得分、胜利概况。这将使黑客变得非常容易,例如修改您的分数。
出于安全原因,我强烈建议使用在线客户端。您可以限制有权访问您的网络服务的域名,并防止任何未经授权的访问您的服务器。如果您制作分布式客户端,那么保护安全就会更加困难,因为任何人都可以下载客户端并访问您的服务。您还必须考虑到,在这种设计中,有人可以通过使用计算机国际象棋引擎来制作自己的作弊客户端。
如果您需要更多帮助,请随时在我的网页上查找我的联系信息。
如果您想了解有关编写国际象棋引擎的更多信息并下载一些免费源代码,请访问我的博客:www.chessbin.com< /a>
I have done something similar for my online chess site at: www.geekswithchess.com.
I implemented my chess system in C# using a client server architecture. I used Microsoft Silverlight for the client and Windows Communication Foundation (WCF) Services for the server.
You could go with a client to client desingn but than each client would have to keep it's own information like score, wins profile. This would make it very easy to hack and for example modify your score.
I would strongly suggest an online client is for security reasons. You can limit the domain name that has access to your web services and prevent any unauthorized access to your server. If you make a distributed client than it will be far more difficult to secure since anyone can download the client and access your services. You also have to consider that in this design someone can make their own client that cheats by using a computer chess engine.
If you need more help feel free to lookup my contact info on my web page.
If you would like to learn more about writing a chess engine and download some free source code visit my blog: www.chessbin.com
如果您使用 Java,则可以使用 Java 套接字。我听说在两者之间建立联系非常容易。
在快速谷歌搜索中,我想出了这个: http ://www.devarticles.com/c/a/Java/Socket-Programming-in-Java/
这可能会有所帮助。
If you're using Java, you can use Java sockets. I've heard that it is really easy to build the connection between the two.
On a quick Google search, I came up with this: http://www.devarticles.com/c/a/Java/Socket-Programming-in-Java/
That might be helpful.
如果您确实在机器之间进行套接字连接,请考虑进行测试。
如果它们互相发送文本移动,测试会容易得多,然后您可以使用 telnet 手动测试它,而不是使用一些复杂的远程对象东西(尽管可能有很多工具用于测试/监视 J2EE 类型系统)。
If you do do a socket connection between the machines think about testing.
It would be much easier to test if they send text moves to each other then you can test it manually with telnet rather than some complex remote object thing (although there are probably lots of tools for testing/monitoring a J2EE type system).