Skip to content

Commit ea86110

Browse files
committed
Revert "Make sure to pick four different numbers for 22.2"
This reverts commit 6b80cc9.
1 parent 5776b07 commit ea86110

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

day22/experiments/day22.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,10 @@ int64_t findBestScore(std::vector<int64_t> input) {
5757
int64_t bound = 9;
5858
for (int64_t x1 = -bound; x1 <= bound; x1++) {
5959
for (int64_t x2 = -bound; x2 <= bound; x2++) {
60-
if (x1 == x2) continue;
6160
std::cout << "Searching (" << x1 << ", " << x2 << ")" << std::endl;
6261
#pragma omp parallel for
6362
for (int64_t x3 = -bound; x3 <= bound; x3++) {
64-
if (x3 == x2 || x3 == x1) continue;
6563
for (int64_t x4 = -bound; x4 <= bound; x4++) {
66-
if (x4 == x3 || x4 == x2 || x4 == x1) continue;
6764
int64_t n = score(input, x1, x2, x3, x4);
6865
if (n > bestScore) {
6966
std::cout << "New best: (" << x1 << ", " << x2 << ", " << x3 << ", " << x4 << ") -> " << n << std::endl;

day22/src/day22.dart

+4-7
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,11 @@ int score(List<int> input, int x1, int x2, int x3, int x4) {
4848
int findBestScore(List<int> input) {
4949
int bestScore = 0;
5050
int bound = 9;
51-
for (int x1 = -bound; x1 <= bound; x1++) {
52-
for (int x2 = -bound; x2 <= bound; x2++) {
53-
if (x1 == x2) continue;
51+
for (var x1 = -bound; x1 <= bound; x1++) {
52+
for (var x2 = -bound; x2 <= bound; x2++) {
5453
print("Searching ($x1, $x2, ...)");
55-
for (int x3 = -bound; x3 <= bound; x3++) {
56-
if (x3 == x2 || x3 == x1) continue;
57-
for (int x4 = -bound; x4 <= bound; x4++) {
58-
if (x4 == x3 || x4 == x2 || x4 == x1) continue;
54+
for (var x3 = -bound; x3 <= bound; x3++) {
55+
for (var x4 = -bound; x4 <= bound; x4++) {
5956
int n = score(input, x1, x2, x3, x4);
6057
if (n > bestScore) {
6158
bestScore = n;

0 commit comments

Comments
 (0)