New Year's resolution: a chess engine written in BASH script

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

bob
Posts: 20340
Joined: Mon Feb 27, 2006 6:30 pm
Location: Birmingham, AL

Re: New Year's resolution: a chess engine written in BASH sc

Post by bob » Sat Jan 23, 2010 2:37 am

benstoker wrote:It's stoopid, I know. But, it's been done in Javascript. I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
This is not a hard project, but it is a painful one. And it would be slow beyond belief, since bash is a true interpreter and it would continually pass over the script, parsing and executing as it searches. Slow is not strong enough to describe this. :)

User avatar
hgm
Posts: 22206
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Contact:

Re: New Year's resolution: a chess engine written in BASH sc

Post by hgm » Sat Jan 23, 2010 10:24 am

benstoker wrote:
hgm wrote:Well, it can't be that difficult to translate micro-Max 1.6 into a bash script? Only bout 100 lines...
But can you do C pointers in BASH? Too advanced for BASH, non?
Micro-Max des not really use pointers. I think the one place it does (collecting the input line) could just as easily be re-written using indexing.

Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 9:01 pm
Location: Irvine, CA, USA

Re: New Year's resolution: a chess engine written in BASH sc

Post by Dirt » Sat Jan 23, 2010 6:14 pm

bob wrote:
benstoker wrote:I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
This is not a hard project, but it is a painful one. And it would be slow beyond belief, since bash is a true interpreter and it would continually pass over the script, parsing and executing as it searches. Slow is not strong enough to describe this. :)
Great! Maybe I'd actually be able to beat it.

User avatar
Greg Strong
Posts: 386
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

Re: New Year's resolution: a chess engine written in BASH sc

Post by Greg Strong » Sat Jan 23, 2010 8:17 pm

benstoker wrote:It's stoopid, I know. But, it's been done in Javascript. I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
BASH? Too easy. What the world needs is an engine written in Logo 8-)

User avatar
smcracraft
Posts: 592
Joined: Wed Mar 08, 2006 7:08 pm

Re: New Year's resolution: a chess engine written in BASH sc

Post by smcracraft » Sat Jan 23, 2010 9:00 pm

Perl and Python would be interesting choices... at the end of your
exercise (whatever language), you will know that language better...

and that's a plus.

Then try converting it to other languages to increase breadth.

Edmund
Posts: 668
Joined: Mon Dec 03, 2007 2:01 pm
Location: Barcelona, Spain
Contact:

Re: New Year's resolution: a chess engine written in BASH sc

Post by Edmund » Sat Jan 23, 2010 9:37 pm

Greg Strong wrote:
benstoker wrote:It's stoopid, I know. But, it's been done in Javascript. I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
BASH? Too easy. What the world needs is an engine written in Logo 8-)
Is there actually a way to interact with this green spot on the screen once the program has started?

User avatar
Greg Strong
Posts: 386
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

Re: New Year's resolution: a chess engine written in BASH sc

Post by Greg Strong » Sat Jan 23, 2010 11:31 pm

Edmund wrote:
Greg Strong wrote:
benstoker wrote:It's stoopid, I know. But, it's been done in Javascript. I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
BASH? Too easy. What the world needs is an engine written in Logo 8-)
Is there actually a way to interact with this green spot on the screen once the program has started?
Haha... you caught me! A chess program in Logo is probably not possible, as I don't recall any way to interact with the turtle (although there might be. I haven't programmed in logo since I was like 10 :D)

MattieShoes
Posts: 718
Joined: Fri Mar 20, 2009 7:59 pm

Re: New Year's resolution: a chess engine written in BASH sc

Post by MattieShoes » Sun Jan 24, 2010 12:47 am

I wrote one in perl. I think nps was in 200 or 300. I eventually abandoned it because with the long capture sequences and whatnot, even a 1 ply search could take an absurd amount of time.

Edmund
Posts: 668
Joined: Mon Dec 03, 2007 2:01 pm
Location: Barcelona, Spain
Contact:

Re: New Year's resolution: a chess engine written in BASH sc

Post by Edmund » Sun Jan 24, 2010 5:59 am

Greg Strong wrote:
Edmund wrote:
Greg Strong wrote:
benstoker wrote:It's stoopid, I know. But, it's been done in Javascript. I would like to see an obviously very basic script that searches 3 or 4 ply, with simple piece value eval. A minimax and no alpha-beta, etc.

Anybody out there who could help?

The world is crying out for a BASH chess engine.
BASH? Too easy. What the world needs is an engine written in Logo 8-)
Is there actually a way to interact with this green spot on the screen once the program has started?
Haha... you caught me! A chess program in Logo is probably not possible, as I don't recall any way to interact with the turtle (although there might be. I haven't programmed in logo since I was like 10 :D)
When I wrote that I have just tried a very basic web application, able to let the turtle walk forwards, right, left and so on.

Then I found a more advanced interpreter. FMSLogo has the following features:
FMSLogo includes support for

* "Standard" Logo parsing
* Turtle Graphics
* Exception handling
* TCP/IP networking
* Text in all available system fonts
* 1024 independent turtles
* Bitmapped turtles
* MIDI devices
* Direct I/O for controlling external hardware (must be admin)
* Serial and parallel port communications
* Saving and loading images in BMP format
* Calling into native DLLs
* Creating windows dialog boxes
* Event driven programming (mouse, keyboard, timer)
* Controlling multimedia devices (WAV sound files, CD-ROM control, etc.)
* 3D Perspective drawing (wire-frame and solids)
* Creating animated GIFs
This one could easily be used to program a chess engine. Also the GUI would be pretty fun; with the feature "1024 independent turtles" you could create 32 turtles then in combination with "Bitmapped turtles" put some bmp of chess pieces on them and let them run over a chess board. And finally with "Event driven programming" you could easily interact with the user.

regards,
Edmund

User avatar
Greg Strong
Posts: 386
Joined: Sun Dec 21, 2008 5:57 pm
Location: Washington, DC

Re: New Year's resolution: a chess engine written in BASH sc

Post by Greg Strong » Sun Jan 24, 2010 5:29 pm

Too cool :)

Post Reply