Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dana/programs/N_Queens.dana
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ def main
loop:
if col_util >= n_param :
break
if isSafe(board_param, row_param, col_util, n_param) :
if isSafe(board_param, row_param, col_util, n_param) = true:
if row_param < 20 and col_util < 20 : board_param[row_param][col_util] := true

if solveNQueensUtil(board_param, row_param + 1, n_param) :
if solveNQueensUtil(board_param, row_param + 1, n_param) = true:
return : true

if row_param < 20 and col_util < 20 : board_param[row_param][col_util] := false
Expand All @@ -91,7 +91,7 @@ def main
j_snq := j_snq + 1
i_snq := i_snq + 1

if solveNQueensUtil(board_snq, 0, n_param) :
if solveNQueensUtil(board_snq, 0, n_param) = true:
skip
else :
writeString: "No solution exists.\n"
Expand Down
10 changes: 5 additions & 5 deletions dana/programs/calculator.dana
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def main
if idx = len:
writeString: "Invalid\n"
continue: lines
elif is_digit(buf[idx]):
elif is_digit(buf[idx]) = true:
break: a_start
idx := idx + 1
start := idx
Expand All @@ -68,7 +68,7 @@ def main
if idx = len:
p_end := idx
break: a_end
elif not is_digit(buf[idx]):
elif not is_digit(buf[idx]) = true:
p_end := idx
break: a_end
idx := idx + 1
Expand All @@ -86,7 +86,7 @@ def main
if idx = len:
writeString: "Invalid\n"
continue: lines
elif is_operator(buf[idx]):
elif is_operator(buf[idx]) = true:
op := buf[idx]
idx := idx + 1
break: op_detect
Expand All @@ -100,7 +100,7 @@ def main
if idx = len:
writeString: "Invalid\n"
continue: lines
elif is_digit(buf[idx]):
elif is_digit(buf[idx]) = true:
break: b_start
idx := idx + 1
start := idx
Expand All @@ -109,7 +109,7 @@ def main
if idx = len:
p_end := idx
break: b_end
elif not is_digit(buf[idx]):
elif not is_digit(buf[idx]) = true:
p_end := idx
break: b_end
idx := idx + 1
Expand Down
6 changes: 3 additions & 3 deletions dana/programs/sudoku.dana
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def main
num := 1
loop:
if num <= 9:
if isSafe(b, row, col, num):
if isSafe(b, row, col, num) = true:
b[row][col] := num
if solve(b):
if solve(b) = true:
return: true
b[row][col] := 0 # backtrack
num := num + 1
Expand All @@ -107,7 +107,7 @@ def main
i := i + 1
else: break

if solve(board):
if solve(board) = true:
printBoard: board
else:
writeString: "No solution\n"