我目前正在重写我的一个程序.它具有强大的递归功能,解决了peg-solitaire:
int solve(int draw) {
if (finished())
return true;
//loop over every possible move (about 76 long values)
//do a move (access the board, which is a long value)
if (solve(draw + 1))
return true;
return false;
}
Run Code Online (Sandbox Code Playgroud)
所以我想知道使用这样的解决方案是否更快:
solve(int draw, long **moves, long *board) {}
Run Code Online (Sandbox Code Playgroud)
目前,移动和董事会都是全局变量.
当然我要测试它,但如果有人告诉我这个尝试不会有效,我会节省一些时间:).
最好的祝福
我对Fortran 很新.目前我正在编写(或试图编写)一个称为C库的fortran应用程序.
到目前为止,我已经完成了一些工作,但是我仍然坚持使用库中的init函数,它希望argc和argv只是获取调用函数的程序名.
C库需要指向argc和argv的指针:
void init(gint argc, gchar ***argv);
Run Code Online (Sandbox Code Playgroud)
我不知道如何在fortran中表达***argv.其他函数只需要整数,所以我可以毫不费力地使用这个骨架:
interface
subroutine init( argc, argv)
??
end subroutine ee_init
end interface
call init( , )
Run Code Online (Sandbox Code Playgroud)