Re: Problem



"martin" <barus@xxxxxxxxxxxxxx> wrote in message news:d6tj9p$l7$1@xxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I need to genarate 36 numerical values. Priecesly, I have a board 4 x 9 and
> I want to fill it by numbers (4 sets 1..9). Besides there are some rules
> that every cell must meet. I am a beginner at programming in Prolog and I
> have no idea how to start. If to try to generate 36 single values or to try
> to generate a list of values. I would be very grateful for every suggestion
>
> Regards,
> Martin
>
>


Maybe this is something for you:

% genmatrix(Rows,Columns,Matrix)
genmatrix(R,C,M):- genmatrix(1,R,C,M).
genmatrix(_,0,_,[]):-!.
genmatrix(LineStart,R,C,[Line|M]):-
genlist(LineStart,C,Line),
LineStart2 is LineStart+C,
R2 is R-1,
genmatrix(LineStart2,R2,C,M).

% genlist(StartValue,NumValues,List).
genlist(_,0,[]):-!.
genlist(Current,Num,[Current|L]):-
Current2 is Current+1, Num2 is Num-1, genlist(Current2,Num2,L).


.



Relevant Pages

  • Problem
    ... that every cell must meet. ... I am a beginner at programming in Prolog and I ... Prev by Date: ...
    (comp.lang.prolog)
  • Re: Excel Formula help
    ... pothgulla Wrote: ... > I am a 61 year old beginner!!! ... going down until Cell D11. ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Product of "time" and money
    ... I am Complete beginner and wish to multiply a cell containing mins & seconds ... Prev by Date: ...
    (microsoft.public.excel.programming)
  • create and manipulate tables
    ... I am a beginner in this area. ... between table, make the cell bigger than other cells, create another table in ... a cell, put text in different font, etc. ... Prev by Date: ...
    (microsoft.public.word.tables)
  • create and manipulate tables
    ... I am a beginner in this area. ... between table, make the cell bigger than other cells, create another table in ... a cell, put text in different font, etc. ... Prev by Date: ...
    (microsoft.public.word.vba.beginners)