我尝试使用javascript实现路径查找器。为此,我从2d数组创建一个网格,并插入' x' (墙),' o' (空地),' 0' (开始),' g' (目标)。我想从开始到目标增加空心方块,所以我最终会看到这样的东西:' 0',1,2,3,4,5 ...... g
然而,我的网格永远不会超过0和1.我的控制台一直在为剩余的空格返回NaN,我怀疑它是使用parseInt()的一个typeError。请参阅下面的代码 - 非常感谢您的帮助。
// mixin - button shape
@mixin buttonShape {
vertical-align:middle;
line-height:1.333rem;height:2.166rem;
color:#282a2e;
border-radius:0;
margin-top:1.083rem;
margin-bottom:.333rem;
margin-right:1.073rem;
border:none;
transition: background-color .2s;
}
// mixin - button gradients
@mixin gradientNormal {
background-color:#efefee;
background:linear-gradient(to bottom,#efefee 0,#d0d0ce 100%);
box-shadow:inset 0 0 0 .083rem #fff;outline:1px solid silver;
}
@mixin gradientHoverActive {
background:linear-gradient(to bottom,#ffffff 0,#ffffff 100%);
box-shadow:inset 0 0 0 .083rem #fff;outline:2px solid #e87722;
}
// normal state
.ui-widget-header .ui-button, .ui-widget-content .ui-button, .ui-button {
font-size: 12px;
@include buttonShape;
@include gradientNormal;
}
// hover
.ui-widget-header .ui-button:enabled:hover,
.ui-widget-header .ui-button:focus,
.ui-widget-content .ui-button:enabled:hover,
.ui-widget-content .ui-button:focus,
.ui-button:enabled:hover, .ui-button:focus {
@include buttonShape;
@include gradientHoverActive;
}
// active
.ui-widget-header .ui-button:enabled:active,
.ui-widget-content .ui-button:enabled:active,
.ui-button:enabled:active {
@include buttonShape;
@include gradientHoverActive;
}