Re: How to create a square grid like chess board???
From: Heath Hunnicutt (heath-usenet_at_removeThis.ofb.net)
Date: 10/18/04
- Next message: Dmitri Soshnikov: "Re: How to fight semideterminism in Mercury?"
- Previous message: Bart Demoen: "Re: List quastion -- polynomial arithmetic operations"
- In reply to: Bart Demoen: "Re: How to create a square grid like chess board???"
- Next in thread: tombolo: "Re: How to create a square grid like chess board???"
- Reply: tombolo: "Re: How to create a square grid like chess board???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 18 Oct 2004 21:33:34 +0000 (UTC)
On 2004-10-18, Bart Demoen <bmd@cs.kuleuven.ac.be> wrote:
| tombolo wrote:
|> Hi...
|>
|> i'm doing a small system for stowing cargo containers on a
|> vessel. The concept and positioning of stowing these containers are
|> the same as placing a chessman on one of the chessboard's cell. so,
|> how do i implement the rows and columns?
|
| Please try Google. "Prolog chess" does wonders !
Oh, please.
RFC CHARTER FOR comp.lang.prolog:
0.0 All posts requesting advice for prolog representations should be
immediately chastised. These posts are always form university
students attempting to avoid their assigned work. These posts are
never opportunities to spread the ideas of logic programming or
prolog.
Anyway...
I came across a solution to the Chess N-Queens problem here:
http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_11.html
This is what many think of when they think of "Solving a chess
problem" with Prolog. However, the solution I reference takes
advantage of the fact that the problem space can be represented as
possible permutations, some of which satisfy the constraints.
What about a 'real' problem. Suppose you want to put the heavy
containers on the bottom, but the ones that need electricity in
section A, and those which need cooling in A or B, and they need to
also be in a low-cost order to unload a certain order of ports?
The solution can always be represented as a permutation of items in a
list for projects like this where there are a set number of pieces and
a set number of 'berths'. The question is how to search the
permutation space. Especially a real cargo ship, with perhaps 400
containers on it, has multiple real constraints and is a crazy
problem.
|> Can anyone show me an
|> example? i heard it can be done using lists.
|
| Where did you hear that it can be done with lists ? It is most amazing
| that you got such precise information on the power of lists, because
| with lists, you can do "everything" (that can be done in any other
| reasonable programming language) ... So, where did you hear that ?
Wow! Friendly!
|> And one more thing, how do i tell the system to skip the occupied
|> cell?
|> By using the not/1 predicate?
|
| I wouldn't abuse not/1 for skipping occupied cells.
| Not/1 is too powerful and you might skip un-occupied cells by accident.
| Or worse, you might turn a seemingly un-occupied cell into an occupied
| one later on. Scary isn't it ?
It would be scary if you had made it plain instead of meaningless.
| One more person with a very low esteem of this newsgroup :-(
Don't beat yourself up.
Heath
- Next message: Dmitri Soshnikov: "Re: How to fight semideterminism in Mercury?"
- Previous message: Bart Demoen: "Re: List quastion -- polynomial arithmetic operations"
- In reply to: Bart Demoen: "Re: How to create a square grid like chess board???"
- Next in thread: tombolo: "Re: How to create a square grid like chess board???"
- Reply: tombolo: "Re: How to create a square grid like chess board???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|