flutter: Remove algorithm.dart
This commit is contained in:
parent
dc66cbbe83
commit
83eb96ece5
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
This file is part of Sanmill.
|
||||
Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
|
||||
|
||||
Sanmill is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Sanmill is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
abs(value) => value > 0 ? value : -value;
|
||||
|
||||
int binarySearch(List<int> array, int start, int end, int key) {
|
||||
if (start > end) return -1;
|
||||
|
||||
if (array[start] == key) return start;
|
||||
if (array[end] == key) return end;
|
||||
|
||||
final middle = start + (end - start) ~/ 2;
|
||||
if (array[middle] == key) return middle;
|
||||
|
||||
if (key < array[middle]) {
|
||||
return binarySearch(array, start + 1, middle - 1, key);
|
||||
}
|
||||
|
||||
return binarySearch(array, middle + 1, end - 1, key);
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:sanmill/common/algorithm.dart';
|
||||
abs(value) => value > 0 ? value : -value;
|
||||
|
||||
enum MoveType { place, move, remove }
|
||||
|
||||
|
|
Loading…
Reference in New Issue