10000 Fix refactoring error · l0s/advent-of-code-java@8d9dbee · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"8d9dbee113c5cb57616cfdd0678411bd2c5b2c5c","url":"/l0s/advent-of-code-java/commit/8d9dbee113c5cb57616cfdd0678411bd2c5b2c5c","authoredDate":"2020-12-22T18:39:09.000-08:00","committedDate":"2020-12-22T18:39:09.000-08:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eFix refactoring error\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"Fix the refactoring error from generalising the Part 2 logic to\naccommodate both Parts 1 and 2 on Day 22.","authors":[{"login":"l0s","displayName":"Carlos Macasaet","avatarUrl":"https://avatars.githubusercontent.com/u/210451?v=4","path":"/l0s","isGitHub":false}],"committerAttribution":false,"committer":{"login":"l0s","displayName":"Carlos Macasaet","avatarUrl":"https://avatars.githubusercontent.com/u/210451?v=4","path":"/l0s","isGitHub":false},"pusher":null,"pushedDate":null,"parents":["647ebc747dafec3ee8747124e8a1216bcf3488b7"],"globalRelayId":"MDY6Q29tbWl0MzIzNTU0MTUyOjhkOWRiZWUxMTNjNWNiNTc2MTZjZmRkMDY3ODQxMWJkMmM1YjJjNWM=","sha1":"647ebc747dafec3ee8747124e8a1216bcf3488b7","sha2":"8d9dbee113c5cb57616cfdd0678411bd2c5b2c5c"},"currentUser":null,"repo":{"id":323554152,"defaultBranch":"main","name":"advent-of-code-java","ownerLogin":"l0s","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2020-12-22T07:31:06.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/210451?v=4","public":true,"private":false,"isOrgOwned":false},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":40,"text":"@@ -41,7 +41,7 @@ public static void main(final String[] args) throws IOException {","html":"@@ -41,7 +41,7 @@ public static void main(final String[] args) throws IOException {","displayNoNewLineWarning":false,"position":0,"left":40,"right":40},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":41,"text":" player2.addToBottom(p1);","html":" \u003cspan class=pl-s1\u003eplayer2\u003c/span\u003e.\u003cspan class=pl-en\u003eaddToBottom\u003c/span\u003e(\u003cspan class=pl-s1\u003ep1\u003c/span\u003e);","displayNoNewLineWarning":false,"position":1,"left":41,"right":41},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":42,"text":" }","html":" }","displayNoNewLineWarning":false,"position":2,"left":42,"right":42},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":43,"text":" }","html":" }","displayNoNewLineWarning":false,"position":3,"left":43,"right":43},{"stylingDirective":null,"type":"DELETION","blobLineNumber":44,"text":"- var winner = player1cards.isEmpty() ? player2 : player1;","html":"- \u003cspan class=\"pl-smi\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ewinner\u003c/span\u003e = \u003cspan class=\"pl-s1 x x-first\"\u003eplayer1cards\u003c/span\u003e\u003cspan class=\"x\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en x x-last\"\u003eisEmpty\u003c/span\u003e() ? \u003cspan class=\"pl-s1 x x-first x-last\"\u003eplayer2\u003c/span\u003e : \u003cspan class=\"pl-s1 x x-first x-last\"\u003eplayer1\u003c/span\u003e;","displayNoNewLineWarning":false,"position":4,"left":44,"right":43},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":44,"text":"+ var winner = player1.hasCards() ? player1 : player2;","html":"+ \u003cspan class=\"pl-smi\"\u003evar\u003c/span\u003e \u003cspan class=\"pl-s1\"\u003ewinner\u003c/span\u003e = \u003cspan class=\"pl-s1 x x-first\"\u003eplayer1\u003c/span\u003e\u003cspan class=\"x\"\u003e.\u003c/span\u003e\u003cspan class=\"pl-en x x-last\"\u003ehasCards\u003c/span\u003e() ? \u003cspan class=\"pl-s1 x x-first x-last\"\u003eplayer1\u003c/span\u003e : \u003cspan class=\"pl-s1 x x-first x-last\"\u003eplayer2\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":44,"right":44},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":45,"text":" System.out.println(\"Part 1: \" + winner.score());","html":" \u003cspan class=pl-smi\u003eSystem\u003c/span\u003e.\u003cspan class=pl-s1\u003eout\u003c/span\u003e.\u003cspan class=pl-en\u003eprintln\u003c/span\u003e(\u003cspan class=pl-s\u003e\u0026quot;Part 1: \u0026quot;\u003c/span\u003e + \u003cspan class=pl-s1\u003ewinner\u003c/span\u003e.\u003cspan class=pl-en\u003escore\u003c/span\u003e());","displayNoNewLineWarning":false,"position":6,"left":45,"right":45},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":46,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":7,"left":46,"right":46},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":47,"text":" // Part 2","html":" \u003cspan class=pl-c\u003e// Part 2\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":47,"right":47}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":157,"linesChanged":2,"newTreeEntry":{"lineCount":157,"path":"src/test/java/com/macasaet/Day22.java","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/test/java/com/macasaet/Day22.java","mode":100644},"linesAdded":1,"linesDeleted":1,"path":"src/test/java/com/macasaet/Day22.java","pathDigest":"0fafe69224a0cf441491f1b81b22ec53022a4e2fa827ace7e0ee3f293ca3a9e7","status":"MODIFIED","truncatedReason":null,"oldOid":"647ebc747dafec3ee8747124e8a1216bcf3488b7","newOid":"8d9dbee113c5cb57616cfdd0678411bd2c5b2c5c","copilotChatReference":null,"deletedSha":"647ebc747dafec3ee8747124e8a1216bcf3488b7","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDQ6VXNlcjIxMDQ1MQ==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/l0s/advent-of-code-java/commit/8d9dbee113c5cb57616cfdd0678411bd2c5b2c5c","fileTreeExpanded":true,"headerInfo":{"additions":1,"deletions":1,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":386,"lineShownCount":9},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"B4GMfvgrDn3WKqvqh60z87RsqmFdF2RvmPW1zcts6wjn1zqjNDMhS551QIdAqGGWMAbLZXlk_a4LLYQHfhjF8w"},"/users/diffview?diff=unified":{"post":"eOdfxMrVgLPPKpyhh4wEZ5t5CMg7mtYTiTk9gzU1YYKYsekZBs2vhYd1d8xAiVYCHxNpzB_pT9Ia4QxJgEFPeQ"},"/notifications/thread":{"post":"Ha5HIakrgMu4qiMgzgdg0A0SCVWPeTq44acrCZX2rrYhZnqC46NOHNQ6Rf2vj17BjhXORLjVY3xQfwMwiFMUZg"}}},"title":"Fix refactoring error · l0s/advent-of-code-java@8d9dbee","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"show_pusher_on_commit_detail":false}}}

Commit 8d9dbee

Browse files
committed
Fix refactoring error
Fix the refactoring error from generalising the Part 2 logic to accommodate both Parts 1 and 2 on Day 22.
1 parent 647ebc7 commit 8d9dbee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/java/com/macasaet/Day22.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void main(final String[] args) throws IOException {
4141
player2.addToBottom(p1);
4242
}
4343
}
44-
var winner = player1cards.isEmpty() ? player2 : player1;
44+
var winner = player1.hasCards() ? player1 : player2;
4545
System.out.println("Part 1: " + winner.score());
4646

4747
// Part 2

0 commit comments

Comments
 (0)