For Programmers: Free Programming Magazines  


Home > Archive > Lisp > December 2007 > My fist real Lisp program!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author My fist real Lisp program!
jrwats

2007-12-23, 7:17 pm

http://uacomps.dnsdojo.com:7159

It's running the hunchentoot webserver on a 500MHz Pentium II so don't
expect fast responses :)

For anyone familiar with game trees, it uses Alpha-Beta pruning and
iterative deepening depth first search. I haven't implemented
transposition tables yet, and plan on doing so. Also, the evaluation
function is very minimal and doesn't account for king safety (I
haven't seen the computer castle once). But the AI is only 1500 lines
of code! Hurray Lisp!
livingcosmos.org

2007-12-23, 7:17 pm

On Dec 23, 3:19=A0pm, jrwats <jrw...@gmail.com> wrote:
> http://uacomps.dnsdojo.com:7159
>


Nice ajaxey interface... maybe use standard PGN and add the ability to
save games?

The PGN for 1. PE4 should just be 1. e4
Timofei Shatrov

2007-12-23, 7:17 pm

On Sun, 23 Dec 2007 12:19:24 -0800 (PST), jrwats <jrwats@gmail.com> tried to
confuse everyone with this message:

>http://uacomps.dnsdojo.com:7159
>
>It's running the hunchentoot webserver on a 500MHz Pentium II so don't
>expect fast responses :)
>
>For anyone familiar with game trees, it uses Alpha-Beta pruning and
>iterative deepening depth first search. I haven't implemented
>transposition tables yet, and plan on doing so. Also, the evaluation
>function is very minimal and doesn't account for king safety (I
>haven't seen the computer castle once). But the AI is only 1500 lines
>of code! Hurray Lisp!


Hmm, /js/chess.js says that it "is a complete chess AI written entirely in
JavaScript"

Is there actually anything related to Lisp besides the webserver
it runs on?

--
|Don't believe this - you're not worthless ,gr---------.ru
|It's us against millions and we can't take them all... | ue il |
|But we can take them on! | @ma |
| (A Wilhelm Scream - The Rip) |______________|
livingcosmos.org

2007-12-23, 7:17 pm

On Dec 23, 3:19=A0pm, jrwats <jrw...@gmail.com> wrote:
> =A0Also, the evaluation
> function is very minimal and doesn't account for king safety


I gave me a pawn on move 17:

1: PE4 NC6
2: NF3 PA6
3: PD4 PD5
4: PE5 BG4
5: PH3 BF3
6: PF3 PF6
7: PF6 PF6
8: BE3 PA5
9: NC3 BB4
10: QD3 QD6
11: KC1 NA7
12: PF4 PC6
13: NE2 QE6
14: PH4 QE4
15: BH3 QD3
16: RD3 KE7
17: NG3 PG5
18: PG5
livingcosmos.org

2007-12-23, 7:17 pm

And it gave me a knight on move 27

1: PE4 NC6
2: NF3 PA6
3: PD4 PD5
4: PE5 BG4
5: PH3 BF3
6: PF3 PF6
7: PF6 PF6
8: BE3 PA5
9: NC3 BB4
10: QD3 QD6
11: KC1 NA7
12: PF4 PC6
13: NE2 QE6
14: PH4 QE4
15: BH3 QD3
16: RD3 KE7
17: NG3 PG5
18: PG5 PG5
19: BG5 KF7
20: PC3 BD6
21: NF5 BB8
22: RE1 PH6
23: BE7 BF4
24: KD1 PB6
25: BA3 NB5
26: RF3 NA3
27: RF4 NF6
28: PA3
livingcosmos.org

2007-12-23, 7:17 pm

Wow, it even knows when it gets mated. What a nice feeling. I never
ever have beaten a computer in years of playing chess. Thanks for the
experience!

1: PE4 NC6
2: NF3 PA6
3: PD4 PD5
4: PE5 BG4
5: PH3 BF3
6: PF3 PF6
7: PF6 PF6
8: BE3 PA5
9: NC3 BB4
10: QD3 QD6
11: KC1 NA7
12: PF4 PC6
13: NE2 QE6
14: PH4 QE4
15: BH3 QD3
16: RD3 KE7
17: NG3 PG5
18: PG5 PG5
19: BG5 KF7
20: PC3 BD6
21: NF5 BB8
22: RE1 PH6
23: BE7 BF4
24: KD1 PB6
25: BA3 NB5
26: RF3 NA3
27: RF4 NF6
28: PA3 NH5
29: RF3 KG8
30: NE7 KH7
31: RF7 NG7
32: BF5
jrwats

2007-12-23, 7:17 pm

On Dec 23, 3:46 pm, g...@mail.ru (Timofei Shatrov) wrote:
> On Sun, 23 Dec 2007 12:19:24 -0800 (PST), jrwats <jrw...@gmail.com> tried to
> confuse everyone with this message:
>
>
>
That was written a while back. I need to remove that. I had
aspirations of writing it entirely in JS, but soon realized it'd be
frustratingly slow to play. The interface is in JS. All AI is Lisp.[color=darkred]
>
> Hmm, /js/chess.js says that it "is a complete chess AI written entirely in
> JavaScript"
>
> Is there actually anything related to Lisp besides the webserver
> it runs on?
>
> --
> |Don't believe this - you're not worthless ,gr---------.ru
> |It's us against millions and we can't take them all... | ue il |
> |But we can take them on! | @ma |
> | (A Wilhelm Scream - The Rip) |______________|


Vityok

2007-12-24, 8:15 am

On Dec 23, 10:19=A0pm, jrwats <jrw...@gmail.com> wrote:
> http://uacomps.dnsdojo.com:7159
>
> It's running the hunchentoot webserver on a 500MHz Pentium II so don't
> expect fast responses :)
>
> For anyone familiar with game trees, it uses Alpha-Beta pruning and
> iterative deepening depth first search. =A0I haven't implemented
> transposition tables yet, and plan on doing so. =A0Also, the evaluation
> function is very minimal and doesn't account for king safety (I
> haven't seen the computer castle once). =A0But the AI is only 1500 lines
> of code! =A0Hurray Lisp!


It looks !

BTW, on level 1, I have won! Unfortunately, the server did not
confirm this,
and it went thinking forever:

White Black
1: E4 D5
2: D3 xE4
3: xE4 QxD1!
4: KxD1 E5
5: NF3 BE6
6: NxE5 BxA2
7: NA3 BxA3
8: xA3 BD5
9: BD3 BxE4
10: BxE4 NC6
11: F4 NxE5
12: xE5 NF6
13: xF6 xF6
14: BF4 C6
15: RE1 KD8
16: C4 KC8
17: BF5! KD8
18: KC2 RB8
19: RD1!
Slobodan Blazeski

2007-12-24, 8:15 am

On Dec 23, 12:19 pm, jrwats <jrw...@gmail.com> wrote:
> http://uacomps.dnsdojo.com:7159
>
> It's running the hunchentoot webserver on a 500MHz Pentium II so don't
> expect fast responses :)
>
> For anyone familiar with game trees, it uses Alpha-Beta pruning and
> iterative deepening depth first search. I haven't implemented
> transposition tables yet, and plan on doing so. Also, the evaluation
> function is very minimal and doesn't account for king safety (I
> haven't seen the computer castle once). But the AI is only 1500 lines
> of code! Hurray Lisp!


Very nice congratulation.

Slobodan
vanekl

2007-12-25, 7:13 pm

That was fun, until it went into an infinite loop at mate.

1: g3 Nf6
2: b3 Nc6
3: Bg2 d5
4: Nf3 e5
5: d3 Qd6
6: Kg1 Be6
7: Ba3 Qxa3
8: Nxa3 Bxa3
9: Qd2 Bd6
10: Rd1 Nd4
11: c3 Nxf3+
12: xf3 Ne4
13: xe4 xe4
14: xe4 Bxb3
15: xb3 c6
16: Qxd6 f6
17: Qd7+ Kf8
18: Qxb7 Ke8
19: Qxa8+ Ke7
20: Qxh8 Ke6
21: Qe8+


Daniel Weinreb

2007-12-26, 7:11 pm

Congratulations! Very nice!
-- Dan
Rico Secada

2007-12-28, 7:13 pm

On Sun, 23 Dec 2007 12:19:24 -0800 (PST)
jrwats <jrwats@gmail.com> wrote:

> http://uacomps.dnsdojo.com:7159
>
> It's running the hunchentoot webserver on a 500MHz Pentium II so don't
> expect fast responses :)
>
> For anyone familiar with game trees, it uses Alpha-Beta pruning and
> iterative deepening depth first search. I haven't implemented
> transposition tables yet, and plan on doing so. Also, the evaluation
> function is very minimal and doesn't account for king safety (I
> haven't seen the computer castle once). But the AI is only 1500 lines
> of code! Hurray Lisp!


Congrats! That looks really .

Would you mind sharing the source for educational purposes?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com