简体   繁体   English

覆盖序言列表中的元素

[英]override an element in a list in prolog

I have the following problem: 我有以下问题:

I have a list with 9 positions and I have this function putPiece(Piece, Board, Line, Column) that puts a Piece in a Position Line, Column of a Board (the list of 9 positions) I'm trying to check if any position is already filled so that I don't try to put anything in it since it isn't possible (right?) can you please help me make a function checkIfFree(Board, Line, Column) that check is the position (Line, Column) of the board is already occupied or not... 我有一个包含9个位置的列表,并且我具有此功能putPiece(Piece, Board, Line, Column) ,该功能将一块放置在一个位置行,一个董事会的列中(9个位置的列表),我正在尝试检查是否有位置已经填满,所以我不可能尝试在其中放置任何东西,因为不可能(对吗?),请您帮我建立一个函数checkIfFree(Board, Line, Column)来检查位置(Line,栏)是否已被占用...

假设一个自由位置由一个自由变量var(X)应该可以解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM