FSHF
FSHF
CC#
Created by FSHF on 5/23/2023 in #help
✅ How to make this loop
switch (chessPiece)
{
case "Knight":
if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber -1))
theGrid[currentCell.RowNumber + 2, currentCell.ColumnNumber + 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 2, currentCell.ColumnNumber - 1))
theGrid[currentCell.RowNumber + 2, currentCell.ColumnNumber - 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber +1))
theGrid[currentCell.RowNumber - 2, currentCell.ColumnNumber + 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber -1))
theGrid[currentCell.RowNumber - 2, currentCell.ColumnNumber - 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 1, currentCell.ColumnNumber + 2))
theGrid[currentCell.RowNumber + 1, currentCell.ColumnNumber + 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 1, currentCell.ColumnNumber - 2))
theGrid[currentCell.RowNumber + 1, currentCell.ColumnNumber - 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber - 1, currentCell.ColumnNumber + 2))
theGrid[currentCell.RowNumber - 1, currentCell.ColumnNumber + 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -1, currentCell.ColumnNumber -2))
theGrid[currentCell.RowNumber - 1, currentCell.ColumnNumber - 2].LegalNextMove = true;

break;
switch (chessPiece)
{
case "Knight":
if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber -1))
theGrid[currentCell.RowNumber + 2, currentCell.ColumnNumber + 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 2, currentCell.ColumnNumber - 1))
theGrid[currentCell.RowNumber + 2, currentCell.ColumnNumber - 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber +1))
theGrid[currentCell.RowNumber - 2, currentCell.ColumnNumber + 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -2, currentCell.ColumnNumber -1))
theGrid[currentCell.RowNumber - 2, currentCell.ColumnNumber - 1].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 1, currentCell.ColumnNumber + 2))
theGrid[currentCell.RowNumber + 1, currentCell.ColumnNumber + 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber + 1, currentCell.ColumnNumber - 2))
theGrid[currentCell.RowNumber + 1, currentCell.ColumnNumber - 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber - 1, currentCell.ColumnNumber + 2))
theGrid[currentCell.RowNumber - 1, currentCell.ColumnNumber + 2].LegalNextMove = true;

if(isSafe(currentCell.RowNumber -1, currentCell.ColumnNumber -2))
theGrid[currentCell.RowNumber - 1, currentCell.ColumnNumber - 2].LegalNextMove = true;

break;
Instead of doing this, is there a way to simplyfy it
12 replies
CC#
Created by FSHF on 5/11/2023 in #help
var, static void
Need to use same var for 2 diffrent static void, how?
10 replies
CC#
Created by FSHF on 5/10/2023 in #help
clone
Instead of removing last number i would like to clone, how?
private void btnpocl(object sender, EventArgs e)
{

if (ccal.Length > 0)
{
ccal = ccal.Remove(ccal.Length - 1, 1);
}

txtbout.Text = ccal;
}
private void btnpocl(object sender, EventArgs e)
{

if (ccal.Length > 0)
{
ccal = ccal.Remove(ccal.Length - 1, 1);
}

txtbout.Text = ccal;
}
57 replies
CC#
Created by FSHF on 5/10/2023 in #help
whats the symbol for power of?
symbol or what i gotta do to get it
15 replies