我有三个单选按钮,我正在使用它.无论我选择哪一个,它似乎默认为第一个.它在实际分配值方面有效,但第二个单选按钮似乎不起作用.
if ($radDB1.Checked = $true){
$database = 'EXDB01_005'
}
if($radDB2.Checked = $true){
$database = 'EXDB02_005'
}
if ($radDB5.Checked = $true){
$database = 'EXDB01_005'
}
Run Code Online (Sandbox Code Playgroud)
它们放在一个组框中,我试图在这里访问:
switch ($grpEXDatabase)
{
$radDB1.Checked { $database = 'EXDB01_005' }
$radDB2.Checked { $database = 'EXDB02_005' }
$radDB5.Checked { $database = 'EXDB01_005' }
}
Run Code Online (Sandbox Code Playgroud)
这没用.有谁知道这是怎么回事?
我正在编写一个程序来解决 nxn 8 拼图问题。我的曼哈顿计算函数与我正在测试我的程序的谜题相差两个,我遇到了困难。这最终将扩展为使用 A* 寻路算法,但我还没有到那里。
这是我的函数(基于棋盘的初始状态,不考虑到目前为止采取的移动量):
// sum of Manhattan distances between blocks and goal
public int Manhattan() // i don't think this is right yet - check with vince/thomas
{
int distance = 0;
// generate goal board
int[][] goal = GoalBoard(N);
// iterate through the blocks and check to see how far they are from where they should be in the goal array
for(int row=0; row<N; row++){
for(int column=0; column<N; column++){
if(blocks[row][column] == 0)
continue;
else
distance …Run Code Online (Sandbox Code Playgroud)