>For example, I want to write a chess game!
>
>Create Table Strategy (AIOrder N(8), AIDescript C(80), AICoding M)
>
>where AICoding is carry a normal VFP coding..
>
>
Can we run a list of Memo code from table?!>
>Since this Strategy can FULLY add/edit/delete/Re-order etc...
>
>There will something like Run-Time Learn!!
>
>the program will Sort the AIOrder and run the AICoding one by one..
>
>Then, it would more interest to make a complex game! ^-^;
No is the easiest answer :) But in the past with AI I built a dbms system when Turkish lecturers said "no" :) Why not the reverse be impossible.
AI systems use internal, external databases (not a dbc) and define rules to solve the problem. On the fly it might add other rules. VFP has the capability to deal with databases :) and can compile (now) at runtime. BUT there is a big difference besides complexity, with AI you don't even know if the problem has a solution at the beginning. You just define how it might be solved. Start with an easier problem and if you can solve it in VFP than go on :)
It's called Hanoi towers (actually solved in many languages - with some differing in quantity of code lines :). You have 3 sticks, N different size disks is placed in 1st stick. Order of sticks is as the largest at the bottom. Like this :
A B C
| | |
- | |
--- | |
----- | |
------- | |
You would move the disks from A to C, using B as a storage helper. Of course there are some rules :)
1) No larger disk cannot come over a smaller
----- -----
- --- Are illegal moves.
2) But even the smallest disk could be on top of largest (reverse of 1)
----- -
------- ------- Are legal moves.
3) You cannot move more than one disk at a time
Here is the example code solving it as is :
/*
Turbo Prolog 2.0 Chapter 18, Example Program 5
Copyright (c) 1986, 88 by Borland International, Inc
domains
loc = right; middle; left
predicates
hanoi(integer)
move(integer, loc, loc, loc)
inform(loc, loc)
clauses
hanoi(N) :- move(N, left, middle, right).
move(1, A, _, C) :- inform(A, C), !.
move(N, A, B, C) :-
N1=N-1, move(N1, A, C, B),
inform(A, C), move(N1, B, A, C).
inform(Loc1, Loc2) :- write("\nMove a disk from ", Loc1, " to ", Loc2).
I didn't even clear out empty lines :) Core of program is only move(). Other are user interface parts. Other than write() all functions (predicates) are UDF. Of course there are limitations with this code. On a typical 286 you wouldn't be able to ask for 26 disks w/o arranging stack size. OTOH you would get response promptly as you ask : hanoi(20) or hanoi(24). 20 and 24 denote disk counts.
Placing n queens on n*n chessboard (as none could threaten another - 4*4 at least) solution is less than 50 lines including informer routines (? or messagebox).
But you can communicate with an AI program. It solves the problem you display it using fancy forms :)
I even have a simplier startup problem for you that's needed sometimes and solved in VFP :) You have a table like this :
NodeParent NodeChild
--------- ---------
P1 C1
C1 C2
C1 C3
C2 C3
C2 C4
C3 C4
C3 C5
C3 C6
....
Notice that this is not only a parent-child-grandchild relation. Rather than a schema of street network nodes. Take me to C6 from P1 :) What routes a taxi driver could follow (and which one if you're a stranger :)
PS: If table is this much short than solution is very simple. I don't know the exact reccount(). Good luck :)
Cetin