首页 \ 问答 \ 国际象棋合法移动生成java库[已关闭](java library for legal move generation in chess [closed])

国际象棋合法移动生成java库[已关闭](java library for legal move generation in chess [closed])

我正在寻找一个API来生成国际象棋合法移动验证,最好是用Java语言。

我可以写我自己的,但这将是一个天真的执行,它会很慢。 所以我需要一个工作库,允许或多或少的以下操作:

Board board = new Board();
board.reset();
board.isMoveLegal(playerNum, fromSquare, toSquare);
board.inputMove(playerNum, fromSquare, toSquare);

我想避免的是必须通过GUI,互联网连接或其他功能浏览完整的国际象棋游戏代码源,而不是移动代。 这对我来说是一个很大的浪费,我宁愿花几个小时来编程我自己的移动验证器,不管它有多慢。 我也不需要任何指导我写自己的图书馆,因为我在互联网上发现了很多。

我在这里问这是因为我在谷歌上运行了几次搜索,没有找到我要找的东西。 所以,如果你知道的话,你可以指出我的链接到这样的工作代码。 谢谢。


I am looking for a an API to generate legal moves validation in chess, preferably in the Java language.

I could write my own but it would be a naive implementation, and it would be slow. So I need a working library allowing more or less the following operations:

Board board = new Board();
board.reset();
board.isMoveLegal(playerNum, fromSquare, toSquare);
board.inputMove(playerNum, fromSquare, toSquare);

What I want to avoid is having to browse a full chess game's code source with GUI, internet connectivity, or other functions than move generation. It would be a big waste of time for me and I'd rather spend a few hours to program my own move validator, no matter how slow. I also don't need any guidelines for writing my own library, as I have found plenty of which on the internet.

I'm asking this here because I have run several searches on google and didn't find what I was looking for. So it would be nice of you to point me out a link to such a working code if you knew any. Thanks.


原文:https://stackoverflow.com/questions/6816422
更新时间:2021-07-16 06:07

最满意答案

苹果重新压缩的文件更大是不足为奇的。 它们针对快速加载而不是小尺寸进行了优化。 如果你不关心大小超过速度,可以肯定地关掉压缩。 即使你关心速度,你也可以比苹果做得更好。

https://imageoptim.com/xcode.html

所以是的,关闭PNG压缩。 我会做的第一件事是建立IPA。 一个ipa实际上是一个压缩文件,因此构建ipa,将其复制到您的mac上的文件夹,用.zip扩展名重命名该文件并双击它。 这将扩大它。 在Payload文件夹中找到应用程序,并右键单击它并选择显示包内容。 你会看到所有的资产。 按大小排序。 我猜你有过大的图像。 在这个尺寸下,我的猜测是,额外的大小可能几乎完全由PNG文件引起。

考虑使用一些非视网膜图像。 老实说,大多数人不会注意到。 iOS将优雅地使用视网膜上的非视网膜。 这可以节省大量的空间,

如果您不需要透明度,请考虑对某些文件使用jpeg文件而不是PNG。 Jpeg文件的效率较低,但可以小得多。 比较两者。 取决于图像连续色调的程度。

默认情况下,PNG文件是32位。 24位色和8位alpha /透明度。 您可以通过转到24位来节省一些大小。 你也可以保存大量的16位或更低的颜色。 在8位PNG文件中使用颜色查找表。 使用Photoshop播放,并在位图深度为8和以下的PNG中保存我们的选项。

我有各种昂贵的压缩软件,但经常使用8美元

https://itunes.apple.com/us/app/lossless-photo-squeezer/id704083918?mt=12

试试8位PNG选项和JPEG选项。

编辑我做了一些研究。 我一直都知道Fireworks做了更好的PNG压缩。 我没有意识到有一个8位Alpha通道的8位PNG。 Photoshop支持8位和1位Alpha通道。 如果透明度需要超过1位,我一直告诉人们使用32位PNG。 将来我会让他们知道8位alpha 8位可能是更好的路线,他们只能使用Photoshop进行文件的最终保存。 他们只需要保存一个32位并在别处压缩。

http://calendar.perfplanet.com/2010/png-that-works/

大卫


It is actually not surprising that the Apple recompressed files are bigger. They are optimized for fast load not small size. If you do not care about size over speed, defiantly do turn off the compression. Even if you do care about speed you can do better than Apple.

https://imageoptim.com/xcode.html

So yes, turn off the PNG compression. The first thing I would do is build the ipa. An ipa is actually a zip file so build the ipa, copy it to a folder on your mac, rename the file with a .zip extension and double click on it. This will expanded it. Find the app in the Payload folder and right mouse click on it and choose show package contents. You will see all the assets. Sort by size. I am guessing you have overly large images. At that size my guess is that the extra size is likely to be caused almost entirely by the PNG files.

Consider using non retina images for some. Honestly most people wont notice. iOS will gracefully use the non retina on retina. This can save a ton of space,

Also consider using jpeg files instead of PNG for some of the files if you do not need transparency. Jpeg files are less efficient but can be much smaller. Compare both. Depends on the extent to which the images are continuous tone.

By default PNG file are 32 bit. 24 bit color and 8 buit alpha/transparency. You can save a bit of size by going to 24 bit. You can also save a lot of size going to 16 bit color or below. At 8 bit PNG files use a color lookup table. Play with Photoshop and the save for we options at PNG with bit depth 8 and below.

I have all sorts of expensive compressing software but often use the $8

https://itunes.apple.com/us/app/lossless-photo-squeezer/id704083918?mt=12

Try the 8 bit PNG option and the JPEG options.

EDIT I did some research. I had always know Fireworks did better PNG compression. I did not realize that there was an 8bit PNG with an 8 Bit alpha channel. Photoshop supports 8 bit with a 1 bit Alpha Channel. I have always told people to use 32 bit PNG if their transparency needed more than 1 bit. In the future I will let them know the 8 bit with 8 bit alpha may be the better route, They just can use Photoshop for the final save of the file. They just need to save a 32 bit and compress elsewhere.

http://calendar.perfplanet.com/2010/png-that-works/

David

相关问答

更多
  • 苹果重新压缩的文件更大是不足为奇的。 它们针对快速加载而不是小尺寸进行了优化。 如果你不关心大小超过速度,可以肯定地关掉压缩。 即使你关心速度,你也可以比苹果做得更好。 https://imageoptim.com/xcode.html 所以是的,关闭PNG压缩。 我会做的第一件事是建立IPA。 一个ipa实际上是一个压缩文件,因此构建ipa,将其复制到您的mac上的文件夹,用.zip扩展名重命名该文件并双击它。 这将扩大它。 在Payload文件夹中找到应用程序,并右键单击它并选择显示包内容。 你会看到所 ...
  • 你可以完全使用fopen (我在跨平台代码中使用它)。 不过你想使用[documentPath fileSystemRepresentation] 。 You can totally use fopen (I use it in cross-platform code). You do however want to use [documentPath fileSystemRepresentation].
  • 我遇到了同样的问题,但录制了视频。 我录制视频并上传到服务器后,我正在删除视频,但我的文档和数据的大小继续增加。 在查看我的Documents and Data文件夹中包含的内容后,我发现问题是/ AppData / Library / Cache /(包名称)/Cache.db-wal上的文件正在增加大小。 我把它从24kb增加到6mb。 但随后,稳定在这个数字上。 无论我拍了多少个视频,大小都不再增加了。 因此,您可以尝试找出正在下载文档和数据内容的内容,以及查看哪些文件的大小正在增加。 您可以按照以下 ...
  • http://forum.unity3d.com/threads/unity-5-3-x-build-size-increase-faq.383533/ 应用程序的大小是由于iOS正在使用的新系统。 基本上,你有两个应用程序在一个(32-64位)加上一些额外的信息和一些非压缩数据。 一旦你上传到AppStore,Apple将进行修剪和正确的工作,然后你才会看到应用程序的实际大小。 http://forum.unity3d.com/threads/unity-5-3-x-build-size-increase ...
  • 没有限制。 当可用空间小于200 MB且为0 MB时,用户将收到警报。 当你填满所有设备内存并尝试写更多时,你的应用程序将崩溃。 There are no limitations. User will get an alert when free space is less than 200 MB and at 0 MB. And your app will crash when you fill all device memory and try to write more.
  • 每个设置都有一个存储的.app文件(Debug,Ad-Hoc,Distribution等)。 “设定”是什么意思? 那些目标,配置,xcconfigs还有别的吗? 当我删除其他构建文件时,应用程序大小很小,但它会丢失合成语音。 唯一重要的是应用程序包中的内容。 当你说“其他构建文件”时,你指的是什么? 当您打开应用程序包时,是否有任何无关的文件? 你有没有设法将构建目录添加到您的Xcode项目? 在设置新的Xcode安装时,我要做的第一件事是将默认构建位置移到项目根目录之外。 这可能有助于您缩小问题的原因。 ...
  • 局部变量的名称根本不包含在输出中。 实例变量和函数的名称可以是,但与应用程序资源的大小相比,它通常不会很重要,除非你做的事情就像自动生成大量复杂的通用代码(非通用代码将由于泛型如何在内部工作,因此名称更短。 您可以看到优化的讨论Swift将自动执行以减少电子邮件线程中符号名称的大小,从这里开始: https : //lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000479 html的 我相信他们最终得到的技术与原始提案有很大不同,但讨论仍 ...
  • 问题是UIImageJPEGRepresentation 。 它不会检索原始JPEG,而是创建一个新的JPEG。 当你使用compressionQuality为1 (可能是为了避免进一步的图像质量损失)时,它会创建这种没有压缩的新表示(通常会导致文件大于原始文件)。 我建议使用getBytes来检索原始资产,而不是通过UIImage对其进行往返并通过UIImageJPEGRepresentation获取数据: ALAssetsLibrary *library = [[ALAssetsLibrary allo ...
  • 应用程序容器的文件系统布局在磁盘上已更改。 使用NSSearchPathForDirectoriesInDomains函数或URLForDirectory:inDomain:appropriateForURL:create:error:方法,而不是依赖硬编码的目录结构。 使用URLForDirectory:inDomain:appropriateForURL:create:error:方法: NSFileManager *yourFileManager = [NSFileManager defaultMan ...
  • iOS的默认图像压缩看起来很糟糕,但使用自定义图集打包策略,您可以覆盖压缩质量并使其更具可忍受性。 您是否从统一构建日志中检查了占用大部分空间的内容? 此外,您在哪里检查下载大小,并测试构建实际上不通过蜂窝下载? AFAIK在app store中显示的大小是一些未压缩的版本,不需要恰好适合100MB As I mention in the comments above, I ended up switching to .NET 2.0 subset from .NET 2.0 and this brough ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)