[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Go Life-and-death problem translated into Lisp Code

gengyangcai

7/15/2015 6:23:00 PM

I just solved a Go life-and-death problem and would like to translate it into simple Lisp code :

The Go problem in question is this : http://www.goproblems...

The solution is this :

Black B , White Q18 , Black Q17 , White A , Black C ---> solved, Black lives

Variant 1 :

Black B , White Q18 , Black C , White Q17 , Black P18 ---> solved, Black lives

Variant 2 :

Black B , White C , Black Q18 , White O17 , ---> solved, Black lives

How do I do this using Lisp ?

CAI GENGYANG
5 Answers

gengyangcai

7/15/2015 6:39:00 PM

0

On Thursday, July 16, 2015 at 2:23:26 AM UTC+8, CAI GENGYANG wrote:
> I just solved a Go life-and-death problem and would like to translate it into simple Lisp code :
>
> The Go problem in question is this : http://www.goproblems...
>
> The solution is this :
>
> Black B , White Q18 , Black Q17 , White A , Black C ---> solved, Black lives
>
> Variant 1 :
>
> Black B , White Q18 , Black C , White Q17 , Black P18 ---> solved, Black lives
>
> Variant 2 :
>
> Black B , White C , Black Q18 , White O17 , ---> solved, Black lives
>
> How do I do this using Lisp ?
>
> CAI GENGYANG

Any hints to start off my first Lisp program? Thanks a lot !

Dimitri Fontaine

7/15/2015 6:53:00 PM

0

CAI GENGYANG <gengyangcai@gmail.com> writes:
> Any hints to start off my first Lisp program? Thanks a lot !

How would you solve it in another programming language? I bet it won't
be that different because of lisp.

Start with the data structure, then the basic API to use them and which
invariant you want to maintain, then build up the user experience you
want to reach on top of that. Something like that, right?

--
dim

gengyangcai

7/15/2015 7:13:00 PM

0

On Thursday, July 16, 2015 at 2:52:15 AM UTC+8, Dimitri Fontaine wrote:
> CAI GENGYANG <gengyangcai@gmail.com> writes:
> > Any hints to start off my first Lisp program? Thanks a lot !
>
> How would you solve it in another programming language? I bet it won't
> be that different because of lisp.
>
> Start with the data structure, then the basic API to use them and which
> invariant you want to maintain, then build up the user experience you
> want to reach on top of that. Something like that, right?
>
> --
> dim

Hmm, unfortunately I have very little experience with programming languages besides finishing a Python course successfully in CodeAcademy and only decided to learn Lisp after reading Paul Graham's On Lisp so I am not familiar with terminology like Data structure , basic API and invariant ... but I'm gonna read up on this stuff and build something

Pascal J. Bourguignon

7/15/2015 8:28:00 PM

0

CAI GENGYANG <gengyangcai@gmail.com> writes:

> On Thursday, July 16, 2015 at 2:52:15 AM UTC+8, Dimitri Fontaine wrote:
>> CAI GENGYANG <gengyangcai@gmail.com> writes:
>> > Any hints to start off my first Lisp program? Thanks a lot !
>>
>> How would you solve it in another programming language? I bet it won't
>> be that different because of lisp.
>>
>> Start with the data structure, then the basic API to use them and which
>> invariant you want to maintain, then build up the user experience you
>> want to reach on top of that. Something like that, right?
>>
>> --
>> dim
>
> Hmm, unfortunately I have very little experience with programming
> languages besides finishing a Python course successfully in
> CodeAcademy and only decided to learn Lisp after reading Paul Graham's
> On Lisp so I am not familiar with terminology like Data structure ,
> basic API and invariant ... but I'm gonna read up on this stuff and
> build something

So you're telling us basically that the CodeAcademy cursus is basically
useless at making people programmers (or at least you).

How interestingâ?¦


--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Thibault Langlois

7/16/2015 11:23:00 AM

0

You can start with a simple representation for the board:

(defparameter *board* (make-array '(19 19) :initial-element nil))

Then write a function that displays the board on the screen (only Ascii characters).

Reading the first chapters of Paul Graham's Ansi Common Lisp should be enough to be able to do that.

T.