This is sort of a side thing I play around with and it's still very much WIP.
For now, it's kind of slow as I tried to keep the code as short as possible.
What it does:
-generates moves
-validates positions
-parses PGN files
-parses FEN notation
-castling
-promotion
What needs work:
-SAN notation
What would be nice to have someday:
-actual AI
-FICS client using LuaSocket
It's open source so if you have suggestions and improvements please visit the repo at:
https://github.com/2dengine/chess.lua
Instructions for the love2d demo:
left click for 1 random move
middle click for 100 moves
right click for new game
Chess.lua
Chess.lua
- Attachments
-
- chess.love
- frontend
- (24.06 KiB) Downloaded 491 times
Last edited by ivan on Sat Dec 11, 2021 8:29 am, edited 8 times in total.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Chess.lua
Code: Select all
Error: terminal.lua:101: bad argument #2 to 'format' (string expected, got boolean)
stack traceback:
[C]: in function 'format'
terminal.lua:101: in function 'printf'
main.lua:69: in function 'status'
main.lua:121: in function 'mousepressed'
main.lua:124: in main chunk
[C]: in function 'require'
[string "boot.lua"]:374: in function <[string "boot.lua"]:244>
[C]: in function 'xpcall'
Help us help you: attach a .love.
Re: Chess.lua
Hey Robin, I must be using a different version of Love2d, could you please try again?
- qubodup
- Inner party member
- Posts: 775
- Joined: Sat Jun 21, 2008 9:21 pm
- Location: Berlin, Germany
- Contact:
Re: Chess.lua
No problem with LOVE 0.9.2 on Linux.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
Re: Chess.lua
Thanks so much for taking a look.
I know a few people on here have programmed chess in Lua.
So I'm open to suggestions on improving the code
in particular with the '10x12 mailbox' and perhaps even the board representation.
Seems like the 'mailbox' approach is more suited for non-interpreted languages.
I know a few people on here have programmed chess in Lua.
So I'm open to suggestions on improving the code
in particular with the '10x12 mailbox' and perhaps even the board representation.
Seems like the 'mailbox' approach is more suited for non-interpreted languages.
Re: Chess.lua
Just wanted to mention that we've released our old "Touch Chess" iOS app for free on Windows:
http://2dengine.com/chess/
It's uses the Faile engine.
And yes, I'm aware of the asynchronous issue and the awful title screen.
http://2dengine.com/chess/
It's uses the Faile engine.
And yes, I'm aware of the asynchronous issue and the awful title screen.
Re: Chess.lua
I wrote a very crude front-end for the moves validator using a chess font (somebody removed quads from Love 0.9 and I'm too lazy to read the docs).
Note that castling doesn't work and EPS captures need more testing.
Other than that it seems to work fine.
Love2D would be a nice front-end for a chess program.
Don't know if it would be worth it to implement the AI in Lua but as a front end it could work really well.
Note that castling doesn't work and EPS captures need more testing.
Other than that it seems to work fine.
Love2D would be a nice front-end for a chess program.
Don't know if it would be worth it to implement the AI in Lua but as a front end it could work really well.
- Attachments
-
- chess.love
- moves validation demo
- (24.06 KiB) Downloaded 328 times
Re: Chess.lua
Attached is a rendering demo using fonts. The drawing routine is slow and highly inefficient but looks cool, so I'll post it.
- Attachments
-
- multiview.love
- (24.15 KiB) Downloaded 299 times
Re: Chess.lua
Since you're too lazy to go to the docs, I'll bring you them:ivan wrote:(somebody removed quads from Love 0.9 and I'm too lazy to read the docs)
lg.drawq wrote:Removed in LÖVE 0.9.0
It has been merged into love.graphics.draw
lg.draw wrote:Available since LÖVE 0.9.0
It has replaced love.graphics.drawq
Synopsis:
love.graphics.draw( image, quad, x, y, r, sx, sy, ox, oy, kx, ky )
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests