From 4d976e5a731808e210d3bbab32238b64dfa35126 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 09:27:18 +0000 Subject: [PATCH 01/41] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 03ee4a3..6975a50 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ pubspec.lock *.xml +*.xml From 091f61b752cae3cbcb2794db8923d75ccbc53ee3 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 09:27:32 +0000 Subject: [PATCH 02/41] Update vcs.xml --- .idea/vcs.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 27f18ff..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file From e88a4dc4df84199f6cc13a6d78f478d2f73b3463 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 09:55:47 +0000 Subject: [PATCH 03/41] t --- .idea/Dart_Functions_BlackJack_Stripped.iml | 1 + .idea/libraries/Dart_SDK.xml | 39 ++-- bin/BlackJack.dart | 2 +- pubspec.lock | 218 ++++++++++++-------- pubspec.yaml | 2 +- 5 files changed, 155 insertions(+), 107 deletions(-) diff --git a/.idea/Dart_Functions_BlackJack_Stripped.iml b/.idea/Dart_Functions_BlackJack_Stripped.iml index 90642e6..ae9af97 100644 --- a/.idea/Dart_Functions_BlackJack_Stripped.iml +++ b/.idea/Dart_Functions_BlackJack_Stripped.iml @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index aabc5f1..45bf086 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,26 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/bin/BlackJack.dart b/bin/BlackJack.dart index f527eab..ac1afc7 100644 --- a/bin/BlackJack.dart +++ b/bin/BlackJack.dart @@ -8,6 +8,6 @@ import 'package:BlackJack/functions/deal_card.dart'; */ void main() { - +print("test"); } diff --git a/pubspec.lock b/pubspec.lock index 2af4907..8ccba44 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,323 +5,369 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" + url: "https://pub.dev" source: hosted - version: "49.0.0" + version: "65.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 + url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "6.3.0" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted version: "3.1.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.dartlang.org" + sha256: "0cec992efb6feaa6141779723bf0119d5f511ebd658aa5225d9bac53cb7e609e" + url: "https://pub.dev" source: hosted - version: "1.6.1" + version: "1.7.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.2.0" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted version: "4.0.2" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.7" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.4" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dartlang.org" + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" pedantic: dependency: "direct dev" description: name: pedantic - url: "https://pub.dartlang.org" + sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" + url: "https://pub.dev" source: hosted version: "1.11.1" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" source: hosted version: "1.5.1" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dartlang.org" + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dartlang.org" + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.4" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dartlang.org" + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dartlang.org" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" source: hosted - version: "0.10.10" + version: "0.10.12" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test: dependency: "direct dev" description: name: test - url: "https://pub.dartlang.org" + sha256: d983a57c33dde6d44b1fb8635f67c91f4b41d26cf227c147963affa97d63563d + url: "https://pub.dev" source: hosted - version: "1.21.6" + version: "1.24.8" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.14" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - url: "https://pub.dartlang.org" + sha256: "2f866bf4b20c11327ac166ee6036bddafb7fe9e35505ff8324f788e66913f967" + url: "https://pub.dev" source: hosted - version: "0.4.18" + version: "0.5.8" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad + url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "12.0.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dartlang.org" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=3.0.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 754dc36..865402b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A sample command-line application. # homepage: https://www.example.com environment: - sdk: '>=2.11.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' #dependencies: # path: ^1.7.0 From 8b97afc17d511502c406fee8b337e4b025a07119 Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 10:04:25 +0000 Subject: [PATCH 04/41] ? to functions --- lib/functions/card_namer.dart | 2 +- lib/functions/check_if_busted.dart | 3 +- lib/functions/check_winner.dart | 2 +- lib/functions/deal_card.dart | 2 +- lib/functions/deck_of_cards.dart | 2 +- lib/functions/money_grab.dart | 4 +- lib/functions/option_select.dart | 2 +- lib/functions/score_function.dart | 2 +- lib/functions/shuffled_deck.dart | 2 +- lib/functions/shuffler.dart | 2 +- lib/functions/status.dart | 2 +- pubspec.lock | 140 +++++++++++++++++++---------- 12 files changed, 106 insertions(+), 59 deletions(-) diff --git a/lib/functions/card_namer.dart b/lib/functions/card_namer.dart index 34f206a..e8a6368 100644 --- a/lib/functions/card_namer.dart +++ b/lib/functions/card_namer.dart @@ -5,6 +5,6 @@ When given an integer between 1-13, it should return the name of the corresponding card (Ignore the suit) */ -String CardNamer(int i){ +String? CardNamer(int i){ } diff --git a/lib/functions/check_if_busted.dart b/lib/functions/check_if_busted.dart index 4ee9ed6..5948405 100644 --- a/lib/functions/check_if_busted.dart +++ b/lib/functions/check_if_busted.dart @@ -23,6 +23,7 @@ if ... true eða false, return true eða false */ -bool CheckIfBusted(List hand){ +bool? CheckIfBusted(List hand){ + } diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index d01e38d..aa5badc 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -15,6 +15,6 @@ of the user, which should have decreased/increased based on if he won or not. import 'package:BlackJack/functions/functions.dart'; -int CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ +int? CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ } \ No newline at end of file diff --git a/lib/functions/deal_card.dart b/lib/functions/deal_card.dart index 3b88502..cb6bf9b 100644 --- a/lib/functions/deal_card.dart +++ b/lib/functions/deal_card.dart @@ -12,6 +12,6 @@ print(deck); // Should print [2, 3, 4] */ -int DealCard(List deck){ +int? DealCard(List deck){ } \ No newline at end of file diff --git a/lib/functions/deck_of_cards.dart b/lib/functions/deck_of_cards.dart index 9e6fb11..ad8d9a5 100644 --- a/lib/functions/deck_of_cards.dart +++ b/lib/functions/deck_of_cards.dart @@ -8,7 +8,7 @@ the number 2 four times etc... Make this function return the List of integers. */ -List DeckOfCards() { +List? DeckOfCards() { List Cards = []; List Deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; List Suits = ["Spaði", "Tígul", "Hjarta", "Lauf"]; diff --git a/lib/functions/money_grab.dart b/lib/functions/money_grab.dart index b397dee..074e671 100644 --- a/lib/functions/money_grab.dart +++ b/lib/functions/money_grab.dart @@ -19,10 +19,10 @@ Can you design the function such that it will ask the user again if he doesn't input a integer? */ -int PlaceBet(int bankRoll) { +int? PlaceBet(int bankRoll) { } -int BuyIn() { +int? BuyIn() { } \ No newline at end of file diff --git a/lib/functions/option_select.dart b/lib/functions/option_select.dart index 981a9b9..9d0d92c 100644 --- a/lib/functions/option_select.dart +++ b/lib/functions/option_select.dart @@ -18,6 +18,6 @@ that the function will simply ask the user again to input an answer? */ -int OptionSelect(String statement, List options) { +int? OptionSelect(String statement, List options) { } \ No newline at end of file diff --git a/lib/functions/score_function.dart b/lib/functions/score_function.dart index 12e7e97..9512ae4 100644 --- a/lib/functions/score_function.dart +++ b/lib/functions/score_function.dart @@ -21,7 +21,7 @@ gets the score 1. So if the method gets the hand [1, 1] the score would be 12 hand = [7, 1] -> Score 18 */ -int CalculateScore(List hand){ +int? CalculateScore(List hand){ } diff --git a/lib/functions/shuffled_deck.dart b/lib/functions/shuffled_deck.dart index d100f4d..d1b3da3 100644 --- a/lib/functions/shuffled_deck.dart +++ b/lib/functions/shuffled_deck.dart @@ -8,6 +8,6 @@ Shuffler And when run, returns a shuffled deck of cards. No inputs, only output. */ -List ShuffledDeck(){ +List? ShuffledDeck(){ } \ No newline at end of file diff --git a/lib/functions/shuffler.dart b/lib/functions/shuffler.dart index 2e980ac..bdd91c7 100644 --- a/lib/functions/shuffler.dart +++ b/lib/functions/shuffler.dart @@ -7,6 +7,6 @@ and outputs a shuffled list of integers. I.e, it should return a RANDOMIZED version of the list. */ -List Shuffler(List theList){ +List? Shuffler(List theList){ } \ No newline at end of file diff --git a/lib/functions/status.dart b/lib/functions/status.dart index bf31751..38a57af 100644 --- a/lib/functions/status.dart +++ b/lib/functions/status.dart @@ -14,7 +14,7 @@ on what hand he has, his score and the hand of the house. hand before showdown.) */ -List CardNameList(List playerHand){ +List? CardNameList(List playerHand){ } diff --git a/pubspec.lock b/pubspec.lock index 2af4907..c98fc22 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,323 +5,369 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + sha256: d976d24314f193899a3079b14fe336215a63a3b1e1c3743eabba8f83e049e9a9 + url: "https://pub.dev" source: hosted version: "49.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: "40ba2c6d2ab41a66476f8f1f099da6be0795c1b47221f5e2c5f8ad6048cdffae" + url: "https://pub.dev" source: hosted version: "5.1.0" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + url: "https://pub.dev" source: hosted version: "2.3.1" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "271b8899fc99f9df4f4ed419fa14e2fff392c7b2c162fbb87b222e2e963ddc73" + url: "https://pub.dev" source: hosted version: "2.9.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "5bbf32bc9e518d41ec49718e2931cd4527292c9b0c6d2dffcf7fe6b9a8a8cf72" + url: "https://pub.dev" source: hosted version: "2.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + url: "https://pub.dev" source: hosted version: "1.17.0" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted version: "3.1.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.dartlang.org" + sha256: d2494157c32b303f47dedee955b1479f2979c4ff66934eb7c0def44fd9e0267a + url: "https://pub.dev" source: hosted version: "1.6.1" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" source: hosted version: "3.0.2" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" source: hosted version: "6.1.4" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + sha256: "01fb90a581ee2bbca0a1c72b04f73b5e9e89b89bf608c9dfa815ea9cec00f11c" + url: "https://pub.dev" source: hosted version: "3.0.0" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: c51b4fdfee4d281f49b8c957f1add91b815473597f76bcf07377987f66a55729 + url: "https://pub.dev" source: hosted version: "2.1.0" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted version: "4.0.2" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + sha256: "0d4c73c3653ab85bf696d51a9657604c900a370549196a91f33e4c39af760852" + url: "https://pub.dev" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + url: "https://pub.dev" source: hosted version: "0.6.4" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + url: "https://pub.dev" source: hosted version: "1.1.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "80c2989398773fa06e2457e9ff08580f24e9858b28462a722241cb53e5613478" + url: "https://pub.dev" source: hosted version: "0.12.12" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + url: "https://pub.dev" source: hosted version: "1.8.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + sha256: dab22e92b41aa1255ea90ddc4bc2feaf35544fd0728e209638cad041a6e3928a + url: "https://pub.dev" source: hosted version: "1.0.2" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dartlang.org" + sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d" + url: "https://pub.dev" source: hosted version: "2.0.1" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" pedantic: dependency: "direct dev" description: name: pedantic - url: "https://pub.dartlang.org" + sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602" + url: "https://pub.dev" source: hosted version: "1.11.1" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" source: hosted version: "1.5.1" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + sha256: b959af0a045c3484c4a8f4997731f5bfe4cac60d732fd8ce35b351f2d6a459fe + url: "https://pub.dev" source: hosted version: "2.1.2" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + url: "https://pub.dev" source: hosted version: "1.4.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dartlang.org" + sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 + url: "https://pub.dev" source: hosted version: "3.0.1" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dartlang.org" + sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c + url: "https://pub.dev" source: hosted version: "1.1.1" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + sha256: "6db16374bc3497d21aa0eebe674d3db9fdf82082aac0f04dc7b44e4af5b08afc" + url: "https://pub.dev" source: hosted version: "1.0.2" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dartlang.org" + sha256: "8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11" + url: "https://pub.dev" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dartlang.org" + sha256: "52de2200bb098de739794c82d09c41ac27b2e42fd7e23cce7b9c74bf653c7296" + url: "https://pub.dev" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: f8d9f247e2f9f90e32d1495ff32dac7e4ae34ffa7194c5ff8fcc0fd0e52df774 + url: "https://pub.dev" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "862015c5db1f3f3c4ea3b94dc2490363a84262994b88902315ed74be1155612f" + url: "https://pub.dev" source: hosted version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test: dependency: "direct dev" description: name: test - url: "https://pub.dartlang.org" + sha256: "9ffb8dbda445ba2922522423e7c7288967de89129205ce2dadf856abfd2b72ae" + url: "https://pub.dev" source: hosted version: "1.21.6" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: ceeddf59d613e862e77f4b506cfc2945ac9637ce0b4c00f4f4c1ac639f3e9731 + url: "https://pub.dev" source: hosted version: "0.4.14" test_core: dependency: transitive description: name: test_core - url: "https://pub.dartlang.org" + sha256: "2b38b8ecfa37f8d375b4aa2a106a86ade536b577411530c2ea68c83abb1f004b" + url: "https://pub.dev" source: hosted version: "0.4.18" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" source: hosted version: "1.3.1" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + url: "https://pub.dev" source: hosted version: "9.4.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + url: "https://pub.dev" source: hosted version: "1.0.2" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + sha256: "3a969ddcc204a3e34e863d204b29c0752716f78b6f9cc8235083208d268a4ccd" + url: "https://pub.dev" source: hosted version: "2.2.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dartlang.org" + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + url: "https://pub.dev" source: hosted version: "1.2.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <3.0.0" + dart: ">=2.18.0 <4.0.0" From 0e40721702ef5b34dd141934a568545b2a689a18 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 10:06:03 +0000 Subject: [PATCH 05/41] tt --- .idea/Dart_Functions_BlackJack_Stripped.iml | 2 +- .idea/libraries/Dart_SDK.xml | 39 ++++++++++--------- pubspec.lock | 42 ++++++++++----------- pubspec.yaml | 2 +- 4 files changed, 42 insertions(+), 43 deletions(-) diff --git a/.idea/Dart_Functions_BlackJack_Stripped.iml b/.idea/Dart_Functions_BlackJack_Stripped.iml index ae9af97..2c3b394 100644 --- a/.idea/Dart_Functions_BlackJack_Stripped.iml +++ b/.idea/Dart_Functions_BlackJack_Stripped.iml @@ -9,7 +9,7 @@ - + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 45bf086..1fdc1a3 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,26 +1,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/pubspec.lock b/pubspec.lock index 8ccba44..8d7a7fb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "65.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "5.13.0" args: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: coverage - sha256: "0cec992efb6feaa6141779723bf0119d5f511ebd658aa5225d9bac53cb7e609e" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.6.4" crypto: dependency: transitive description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" frontend_server_client: dependency: transitive description: @@ -301,26 +301,26 @@ packages: dependency: "direct dev" description: name: test - sha256: d983a57c33dde6d44b1fb8635f67c91f4b41d26cf227c147963affa97d63563d + sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" url: "https://pub.dev" source: hosted - version: "1.24.8" + version: "1.24.3" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" test_core: dependency: transitive description: name: test_core - sha256: "2f866bf4b20c11327ac166ee6036bddafb7fe9e35505ff8324f788e66913f967" + sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "0.5.3" typed_data: dependency: transitive description: @@ -333,18 +333,18 @@ packages: dependency: transitive description: name: vm_service - sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "12.0.0" + version: "11.10.0" watcher: dependency: transitive description: name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.2" web_socket_channel: dependency: transitive description: @@ -357,10 +357,10 @@ packages: dependency: transitive description: name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.0" yaml: dependency: transitive description: @@ -370,4 +370,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=2.19.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 865402b..754dc36 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A sample command-line application. # homepage: https://www.example.com environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.11.0 <3.0.0' #dependencies: # path: ^1.7.0 From c11a6b5a59deb56e7e73f7f3fa6cdc85a2c3ac9d Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 10:36:44 +0000 Subject: [PATCH 06/41] raise to 2.11 --- pubspec.yaml | 2 +- test/BlackJack_test.dart | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 754dc36..865402b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A sample command-line application. # homepage: https://www.example.com environment: - sdk: '>=2.11.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' #dependencies: # path: ^1.7.0 diff --git a/test/BlackJack_test.dart b/test/BlackJack_test.dart index 5cac432..a94270f 100644 --- a/test/BlackJack_test.dart +++ b/test/BlackJack_test.dart @@ -1,8 +1,8 @@ -import 'package:BlackJack/BlackJack.dart'; -import 'package:test/test.dart'; +// import 'package:BlackJack/BlackJack.dart'; +// import 'package:test/test.dart'; -void main() { - test('calculate', () { - expect(calculate(), 42); - }); -} +// void main() { +// test('calculate', () { +// expect(calculate(), 42); +// }); +// } From d8ca8806d0b29df84983ff577fbab3af6ca57109 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 10:50:44 +0000 Subject: [PATCH 07/41] t --- .gitignore | 1 + pubspec.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6975a50..03ae13e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ pubspec.lock *.xml *.xml +pubspec.lock diff --git a/pubspec.lock b/pubspec.lock index c98fc22..310ae82 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -370,4 +370,4 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.18.0 <4.0.0" + dart: ">=2.18.0 <3.0.0" From f91b85e672e01a00a45122de28c417282a7038fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 10:56:35 +0000 Subject: [PATCH 08/41] shuffle completed --- lib/functions/shuffler.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/functions/shuffler.dart b/lib/functions/shuffler.dart index bdd91c7..58fe1c9 100644 --- a/lib/functions/shuffler.dart +++ b/lib/functions/shuffler.dart @@ -8,5 +8,7 @@ I.e, it should return a RANDOMIZED version of the list. */ List? Shuffler(List theList){ + theList.shuffle(); + return theList; } \ No newline at end of file From 19f9c78480b003492a61f7250067bc5264b610c6 Mon Sep 17 00:00:00 2001 From: OSE-ICE Date: Sat, 21 Oct 2023 10:56:45 +0000 Subject: [PATCH 09/41] =?UTF-8?q?Deck=20of=20Cards=20tilb=C3=BAi=C3=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/Dart_Functions_BlackJack_Stripped.iml | 1 + .idea/libraries/Dart_SDK.xml | 39 ++--- .idea/vcs.xml | 1 - lib/functions/deck_of_cards.dart | 11 +- pubspec.lock | 158 ++++++++++---------- pubspec.yaml | 2 +- test/BlackJack_test.dart | 5 +- 7 files changed, 115 insertions(+), 102 deletions(-) diff --git a/.idea/Dart_Functions_BlackJack_Stripped.iml b/.idea/Dart_Functions_BlackJack_Stripped.iml index 90642e6..ae9af97 100644 --- a/.idea/Dart_Functions_BlackJack_Stripped.iml +++ b/.idea/Dart_Functions_BlackJack_Stripped.iml @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index aabc5f1..63fa9a6 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,26 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 27f18ff..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,5 @@ - \ No newline at end of file diff --git a/lib/functions/deck_of_cards.dart b/lib/functions/deck_of_cards.dart index ad8d9a5..a04f1ce 100644 --- a/lib/functions/deck_of_cards.dart +++ b/lib/functions/deck_of_cards.dart @@ -8,11 +8,20 @@ the number 2 four times etc... Make this function return the List of integers. */ -List? DeckOfCards() { +List DeckOfCards() { List Cards = []; List Deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]; List Suits = ["Spaði", "Tígul", "Hjarta", "Lauf"]; + + for (int i = 0; i < Suits.length; i++) { + for (int j = 0; j < Deck.length; j++) { + Cards.add(Deck[j]); + } + } + + return Cards; } + diff --git a/pubspec.lock b/pubspec.lock index c98fc22..8ccba44 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,50 +5,50 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: d976d24314f193899a3079b14fe336215a63a3b1e1c3743eabba8f83e049e9a9 + sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" url: "https://pub.dev" source: hosted - version: "49.0.0" + version: "65.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "40ba2c6d2ab41a66476f8f1f099da6be0795c1b47221f5e2c5f8ad6048cdffae" + sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "6.3.0" args: dependency: transitive description: name: args - sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.2" async: dependency: transitive description: name: async - sha256: "271b8899fc99f9df4f4ed419fa14e2fff392c7b2c162fbb87b222e2e963ddc73" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "5bbf32bc9e518d41ec49718e2931cd4527292c9b0c6d2dffcf7fe6b9a8a8cf72" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" collection: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.18.0" convert: dependency: transitive description: @@ -61,42 +61,42 @@ packages: dependency: transitive description: name: coverage - sha256: d2494157c32b303f47dedee955b1479f2979c4ff66934eb7c0def44fd9e0267a + sha256: "0cec992efb6feaa6141779723bf0119d5f511ebd658aa5225d9bac53cb7e609e" url: "https://pub.dev" source: hosted - version: "1.6.1" + version: "1.7.0" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - sha256: "01fb90a581ee2bbca0a1c72b04f73b5e9e89b89bf608c9dfa815ea9cec00f11c" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.2.0" glob: dependency: transitive description: name: glob - sha256: c51b4fdfee4d281f49b8c957f1add91b815473597f76bcf07377987f66a55729 + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" http_multi_server: dependency: transitive description: @@ -117,58 +117,58 @@ packages: dependency: transitive description: name: io - sha256: "0d4c73c3653ab85bf696d51a9657604c900a370549196a91f33e4c39af760852" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" js: dependency: transitive description: name: js - sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.6.7" logging: dependency: transitive description: name: logging - sha256: c0bbfe94d46aedf9b8b3e695cf3bd48c8e14b35e3b2c639e0aa7755d589ba946 + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" matcher: dependency: transitive description: name: matcher - sha256: "80c2989398773fa06e2457e9ff08580f24e9858b28462a722241cb53e5613478" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16" meta: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: dab22e92b41aa1255ea90ddc4bc2feaf35544fd0728e209638cad041a6e3928a + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.4" node_preamble: dependency: transitive description: name: node_preamble - sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d" + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" package_config: dependency: transitive description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" pedantic: dependency: "direct dev" description: @@ -205,90 +205,90 @@ packages: dependency: transitive description: name: pub_semver - sha256: b959af0a045c3484c4a8f4997731f5bfe4cac60d732fd8ce35b351f2d6a459fe + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" shelf: dependency: transitive description: name: shelf - sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - sha256: aef74dc9195746a384843102142ab65b6a4735bb3beea791e63527b88cc83306 + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - sha256: e792b76b96a36d4a41b819da593aff4bdd413576b3ba6150df5d8d9996d2e74c + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "6db16374bc3497d21aa0eebe674d3db9fdf82082aac0f04dc7b44e4af5b08afc" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.4" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - sha256: "8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11" + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" source_maps: dependency: transitive description: name: source_maps - sha256: "52de2200bb098de739794c82d09c41ac27b2e42fd7e23cce7b9c74bf653c7296" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" url: "https://pub.dev" source: hosted - version: "0.10.10" + version: "0.10.12" source_span: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: f8d9f247e2f9f90e32d1495ff32dac7e4ae34ffa7194c5ff8fcc0fd0e52df774 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - sha256: "862015c5db1f3f3c4ea3b94dc2490363a84262994b88902315ed74be1155612f" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: @@ -301,73 +301,73 @@ packages: dependency: "direct dev" description: name: test - sha256: "9ffb8dbda445ba2922522423e7c7288967de89129205ce2dadf856abfd2b72ae" + sha256: d983a57c33dde6d44b1fb8635f67c91f4b41d26cf227c147963affa97d63563d url: "https://pub.dev" source: hosted - version: "1.21.6" + version: "1.24.8" test_api: dependency: transitive description: name: test_api - sha256: ceeddf59d613e862e77f4b506cfc2945ac9637ce0b4c00f4f4c1ac639f3e9731 + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.4.14" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - sha256: "2b38b8ecfa37f8d375b4aa2a106a86ade536b577411530c2ea68c83abb1f004b" + sha256: "2f866bf4b20c11327ac166ee6036bddafb7fe9e35505ff8324f788e66913f967" url: "https://pub.dev" source: hosted - version: "0.4.18" + version: "0.5.8" typed_data: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" vm_service: dependency: transitive description: name: vm_service - sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "12.0.0" watcher: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "3a969ddcc204a3e34e863d204b29c0752716f78b6f9cc8235083208d268a4ccd" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" yaml: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=2.18.0 <4.0.0" + dart: ">=3.0.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 754dc36..865402b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A sample command-line application. # homepage: https://www.example.com environment: - sdk: '>=2.11.0 <3.0.0' + sdk: '>=2.12.0 <3.0.0' #dependencies: # path: ^1.7.0 diff --git a/test/BlackJack_test.dart b/test/BlackJack_test.dart index 5cac432..2853330 100644 --- a/test/BlackJack_test.dart +++ b/test/BlackJack_test.dart @@ -1,8 +1,11 @@ +/* import 'package:BlackJack/BlackJack.dart'; import 'package:test/test.dart'; - +/* void main() { test('calculate', () { expect(calculate(), 42); }); } +*/ +*/ \ No newline at end of file From 0b174de1c80d298f9dc1e75d7766eef2887b4a80 Mon Sep 17 00:00:00 2001 From: Hjalti Unnar Agustsson Date: Sat, 21 Oct 2023 11:02:49 +0000 Subject: [PATCH 10/41] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 865402b..754dc36 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: A sample command-line application. # homepage: https://www.example.com environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.11.0 <3.0.0' #dependencies: # path: ^1.7.0 From 965b9d0e4a3f0ae040fc026e0636f25544a8cd3b Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 11:06:31 +0000 Subject: [PATCH 11/41] Update deal_card.dart --- lib/functions/deal_card.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions/deal_card.dart b/lib/functions/deal_card.dart index cb6bf9b..9d7920b 100644 --- a/lib/functions/deal_card.dart +++ b/lib/functions/deal_card.dart @@ -12,6 +12,10 @@ print(deck); // Should print [2, 3, 4] */ -int? DealCard(List deck){ +int DealCard(List deck){ + //int cardNumber = 0; + int cardNumber = deck[0]; + deck.remove(0); + return cardNumber; } \ No newline at end of file From 3fab5a6d2c05aaf5f488c4acee6bb98cb38207b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 11:10:53 +0000 Subject: [PATCH 12/41] shuffled_deck completed --- lib/functions/shuffled_deck.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/functions/shuffled_deck.dart b/lib/functions/shuffled_deck.dart index d1b3da3..065d2ba 100644 --- a/lib/functions/shuffled_deck.dart +++ b/lib/functions/shuffled_deck.dart @@ -9,5 +9,9 @@ And when run, returns a shuffled deck of cards. No inputs, only output. */ List? ShuffledDeck(){ + List? _shuffledDeck = Shuffler(DeckOfCards()); + print("A deck of cards has been shuffled"); + print('Log - shuffled-deck: ${_shuffledDeck}'); + return _shuffledDeck; } \ No newline at end of file From 52021f40b26d8fe554c6ef624ef9134ce6ef22da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 11:17:16 +0000 Subject: [PATCH 13/41] check_if_busted completed --- lib/functions/check_if_busted.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/functions/check_if_busted.dart b/lib/functions/check_if_busted.dart index 5948405..742adf6 100644 --- a/lib/functions/check_if_busted.dart +++ b/lib/functions/check_if_busted.dart @@ -22,8 +22,14 @@ Example inputs if ... true eða false, return true eða false */ - bool? CheckIfBusted(List hand){ - - -} + int sumOfCards = 0; + for(int card in hand){ + sumOfCards += card; + + if(sumOfCards > 21){ + return false; + } + } + return true; +} \ No newline at end of file From efde2fcc10781fa80cd61b51c08eb203a883abeb Mon Sep 17 00:00:00 2001 From: Some0ne3lse <143652507+Some0ne3lse@users.noreply.github.com> Date: Sat, 21 Oct 2023 11:21:55 +0000 Subject: [PATCH 14/41] Create card_namer --- lib/functions/card_namer.dart | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/functions/card_namer.dart b/lib/functions/card_namer.dart index e8a6368..beed135 100644 --- a/lib/functions/card_namer.dart +++ b/lib/functions/card_namer.dart @@ -6,5 +6,34 @@ it should return the name of the corresponding card (Ignore the suit) */ String? CardNamer(int i){ - + var cardName; + switch (i) { + case 1: + return 'A'; + case 2: + return '2'; + case 3: + return '3'; + case 4: + return '4'; + case 5: + return '5'; + case 6: + return '6'; + case 7: + return '7'; + case 8: + return '8'; + case 9: + return '9'; + case 10: + return '10'; + case 11: + return 'J'; + case 12: + return 'Q'; + case 13: + return 'K'; + } + return cardName; } From 24265bb4e2e566b2e6d2d6497ee0f181373b7388 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 11:22:28 +0000 Subject: [PATCH 15/41] b --- .gitignore | 1 + .idea/libraries/Dart_SDK.xml | 39 ++++++++++++++++----------------- pubspec.lock | 42 ++++++++++++++++++------------------ 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 03ae13e..1682205 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ pubspec.lock *.xml pubspec.lock +.idea/libraries/Dart_SDK.xml diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 63fa9a6..1fdc1a3 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,26 +1,25 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/pubspec.lock b/pubspec.lock index 8ccba44..8d7a7fb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "65.0.0" + version: "61.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "5.13.0" args: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: coverage - sha256: "0cec992efb6feaa6141779723bf0119d5f511ebd658aa5225d9bac53cb7e609e" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.6.4" crypto: dependency: transitive description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" frontend_server_client: dependency: transitive description: @@ -301,26 +301,26 @@ packages: dependency: "direct dev" description: name: test - sha256: d983a57c33dde6d44b1fb8635f67c91f4b41d26cf227c147963affa97d63563d + sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" url: "https://pub.dev" source: hosted - version: "1.24.8" + version: "1.24.3" test_api: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" test_core: dependency: transitive description: name: test_core - sha256: "2f866bf4b20c11327ac166ee6036bddafb7fe9e35505ff8324f788e66913f967" + sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" url: "https://pub.dev" source: hosted - version: "0.5.8" + version: "0.5.3" typed_data: dependency: transitive description: @@ -333,18 +333,18 @@ packages: dependency: transitive description: name: vm_service - sha256: a13d5503b4facefc515c8c587ce3cf69577a7b064a9f1220e005449cf1f64aad + sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 url: "https://pub.dev" source: hosted - version: "12.0.0" + version: "11.10.0" watcher: dependency: transitive description: name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.2" web_socket_channel: dependency: transitive description: @@ -357,10 +357,10 @@ packages: dependency: transitive description: name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.0" yaml: dependency: transitive description: @@ -370,4 +370,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=2.19.0 <3.0.0" From f25652f7f3000a093d9ea32f6bdd9e176cc21523 Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 11:31:33 +0000 Subject: [PATCH 16/41] Update draw_card.dart --- lib/functions/draw_card.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/functions/draw_card.dart b/lib/functions/draw_card.dart index 04f09c1..ea86b1b 100644 --- a/lib/functions/draw_card.dart +++ b/lib/functions/draw_card.dart @@ -21,6 +21,8 @@ Add function */ -void DrawCard(List hand, List deck){ +void DrawCard(List hand, List deck){ + hand.add(deck[0]); + deck.removeAt(0); } \ No newline at end of file From 641d4ca5ea513262833a58bd3f05e1b849736b8e Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 11:58:32 +0000 Subject: [PATCH 17/41] create initial deal, fix draw card and deal card --- lib/functions/deal_card.dart | 2 +- lib/functions/draw_card.dart | 3 +-- lib/functions/initial_deal.dart | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/functions/deal_card.dart b/lib/functions/deal_card.dart index 9d7920b..4c283af 100644 --- a/lib/functions/deal_card.dart +++ b/lib/functions/deal_card.dart @@ -16,6 +16,6 @@ int DealCard(List deck){ //int cardNumber = 0; int cardNumber = deck[0]; - deck.remove(0); + deck.removeAt(0); return cardNumber; } \ No newline at end of file diff --git a/lib/functions/draw_card.dart b/lib/functions/draw_card.dart index ea86b1b..e4c21ff 100644 --- a/lib/functions/draw_card.dart +++ b/lib/functions/draw_card.dart @@ -23,6 +23,5 @@ Add function void DrawCard(List hand, List deck){ - hand.add(deck[0]); - deck.removeAt(0); + hand.add(DealCard(deck)); } \ No newline at end of file diff --git a/lib/functions/initial_deal.dart b/lib/functions/initial_deal.dart index b31c3ef..0709928 100644 --- a/lib/functions/initial_deal.dart +++ b/lib/functions/initial_deal.dart @@ -1,3 +1,5 @@ +import 'package:BlackJack/functions/deal_card.dart'; + import 'draw_card.dart'; /* @@ -22,6 +24,10 @@ print(dealerHand); // Should print [2, 4] */ -void InitialDeal(List playerHand, List houseHand, List deck){ +void InitialDeal(List playerHand, List houseHand, List deck){ + DrawCard(playerHand, deck); + DrawCard(houseHand, deck); + DrawCard(playerHand, deck); + DrawCard(houseHand, deck); } \ No newline at end of file From e98876e2580ee7d222fbf036a6ce1fb24d24788e Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 12:00:04 +0000 Subject: [PATCH 18/41] Update return_hand.dart --- lib/functions/return_hand.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/functions/return_hand.dart b/lib/functions/return_hand.dart index 543b98f..cdfcdd9 100644 --- a/lib/functions/return_hand.dart +++ b/lib/functions/return_hand.dart @@ -13,11 +13,21 @@ print(hand); // Should print [] void ReturnHand(List hand, List deck){ - + for (var item in hand) { + deck.add(item); + } + hand.clear(); } void ReturnHands(List playerHand, List houseHand, List deck){ - + for (var item in playerHand) { + deck.add(item); + } + for (var item in houseHand) { + deck.add(item); + } + playerHand.clear(); + houseHand.clear(); } /* Then create another function called ReturnHands that uses the above function From 7c785e52056c9a42df329dbd192e1d1b5243cae3 Mon Sep 17 00:00:00 2001 From: Some0ne3lse <143652507+Some0ne3lse@users.noreply.github.com> Date: Sat, 21 Oct 2023 12:18:50 +0000 Subject: [PATCH 19/41] Create score_function --- lib/functions/score_function.dart | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/functions/score_function.dart b/lib/functions/score_function.dart index 9512ae4..1c1130f 100644 --- a/lib/functions/score_function.dart +++ b/lib/functions/score_function.dart @@ -1,4 +1,3 @@ - /* Create a function called CalculateScore that can calculate the score of a given hand of cards. The score is blackjack score, so the following rules apply @@ -22,6 +21,22 @@ gets the score 1. So if the method gets the hand [1, 1] the score would be 12 */ int? CalculateScore(List hand){ - + int sum = 0; + bool checkIfAce = false; + for (int number in hand) { + if (number == 1 && checkIfAce == false){ + checkIfAce = true; + sum += 11; + } else if (number == 1 && checkIfAce == true) { + sum += 1; + } else if(number >= 2 && number <= 10) { + sum += number; + } else if (number >= 11 && number <= 13){ + sum += 10; + } else if (number == 1){ + sum += 11; + } + } + return sum; } From ee9aebbc927d7ac034f72915853a094f84a64d9e Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 12:20:36 +0000 Subject: [PATCH 20/41] Update money_grab.dart --- lib/functions/money_grab.dart | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/functions/money_grab.dart b/lib/functions/money_grab.dart index 074e671..5fb28db 100644 --- a/lib/functions/money_grab.dart +++ b/lib/functions/money_grab.dart @@ -19,10 +19,38 @@ Can you design the function such that it will ask the user again if he doesn't input a integer? */ +// TEST MAIN FUNCTION +void main(){ + int bankRoll = 1000; + + PlaceBet(bankRoll); + + BuyIn(); +} + int? PlaceBet(int bankRoll) { + int amount; + print("Give me an amount you want to bet"); + amount = int.parse(stdin.readLineSync().toString()); + if (amount is int) { + if (amount > bankRoll || amount == 0){ + print("Your bet is either zero or larger than the bankroll"); + PlaceBet(bankRoll); + } else { + print(amount); // delete + return amount; + } + } else { + print("That is not an integer"); + PlaceBet(bankRoll); + } } int? BuyIn() { - -} \ No newline at end of file + int amount; + print("How large is your buy in?"); + amount = int.parse(stdin.readLineSync().toString()); + print(amount); + return amount; +} From 40602aa5d3790e6dc39cbe955fa5f41919ab16ce Mon Sep 17 00:00:00 2001 From: Some0ne3lse <143652507+Some0ne3lse@users.noreply.github.com> Date: Sat, 21 Oct 2023 12:26:08 +0000 Subject: [PATCH 21/41] Create null check --- lib/functions/avoidNullChecks.dart | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/functions/avoidNullChecks.dart diff --git a/lib/functions/avoidNullChecks.dart b/lib/functions/avoidNullChecks.dart new file mode 100644 index 0000000..5f05868 --- /dev/null +++ b/lib/functions/avoidNullChecks.dart @@ -0,0 +1,41 @@ +import 'dart:io'; + +double nullEscapeAndConvertToDouble() { + String? number; + double? parsedNumber; + + while (parsedNumber == null) { + print("Please enter a valid number: "); + number = stdin.readLineSync(); + + if (number != null) { + parsedNumber = double.tryParse(number); + } + + if (parsedNumber == null) { + print("Invalid option"); + } + } + + return parsedNumber; +} + +int nullEscapeAndConvertToInt() { + String? number; + int? parsedNumber; + + while (parsedNumber == null) { + print("Please enter a valid number: "); + number = stdin.readLineSync(); + + if (number != null) { + parsedNumber = int.tryParse(number); + } + + if (parsedNumber == null) { + print("Invalid option"); + } + } + + return parsedNumber; +} \ No newline at end of file From 392f7820a59639c1766dbeb18816e9a6fceb5000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 12:30:11 +0000 Subject: [PATCH 22/41] hitorstay & optionselect completed --- lib/functions/option_select.dart | 11 +++++++++++ lib/hit_or_stay.dart | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/functions/option_select.dart b/lib/functions/option_select.dart index 9d0d92c..7e32315 100644 --- a/lib/functions/option_select.dart +++ b/lib/functions/option_select.dart @@ -19,5 +19,16 @@ that the function will simply ask the user again to input an answer? */ int? OptionSelect(String statement, List options) { + print(statement); + for(int i = 0; i < options.length; i++){ + print("${i+1}. ${options[i]}"); + } + int? userOption; + try { + userOption = int.tryParse(stdin.readLineSync()!) !- 1; + } catch (e) { + print("You have to type in a number"); + } + return userOption; } \ No newline at end of file diff --git a/lib/hit_or_stay.dart b/lib/hit_or_stay.dart index 9430f61..9504ea4 100644 --- a/lib/hit_or_stay.dart +++ b/lib/hit_or_stay.dart @@ -22,7 +22,27 @@ tell him what card he drew and print the current information of the game. If he busts after drawing this card, break the loop as well. */ + void HitOrStay(List playerHand, List houseHand, List deck){ + print("LOG: HitOrStay started"); List options = ['Hit', 'Stay', 'Quit']; + int? userRequest = null; + int? drawnCard = null; + + while(userRequest != 2 || CheckIfBusted(playerHand) == false){ + userRequest = OptionSelect('Pick an option:', options); + if(userRequest == 0){ // Hit + drawnCard = DealCard(deck); + print("You have drawn: $drawnCard"); + } else if(userRequest == 1 ){ + print("You have selected Stay"); // Stay + return; + } else if(userRequest == 2){ // Quit + return; + } else { + print("Not a valid option."); + } + } + print("LOG: HitOrStay completed"); } \ No newline at end of file From d815a16c69c1831196a6178421bc11b5ff5e98f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 12:33:14 +0000 Subject: [PATCH 23/41] removed print from escapefunction --- lib/functions/avoidNullChecks.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/functions/avoidNullChecks.dart b/lib/functions/avoidNullChecks.dart index 5f05868..1079a17 100644 --- a/lib/functions/avoidNullChecks.dart +++ b/lib/functions/avoidNullChecks.dart @@ -25,7 +25,6 @@ int nullEscapeAndConvertToInt() { int? parsedNumber; while (parsedNumber == null) { - print("Please enter a valid number: "); number = stdin.readLineSync(); if (number != null) { From 7000e4e41045ebba9435af041c153f0e2a5f151a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 12:35:03 +0000 Subject: [PATCH 24/41] added nullEscape to option_select --- lib/functions/option_select.dart | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/functions/option_select.dart b/lib/functions/option_select.dart index 7e32315..940374f 100644 --- a/lib/functions/option_select.dart +++ b/lib/functions/option_select.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'avoidNullChecks.dart'; /* Create a function called OptionSelect which takes in a list of options, prints them out to the user and asks for the user to select an option. @@ -23,12 +24,8 @@ int? OptionSelect(String statement, List options) { for(int i = 0; i < options.length; i++){ print("${i+1}. ${options[i]}"); } - int? userOption; - try { - userOption = int.tryParse(stdin.readLineSync()!) !- 1; - } catch (e) { - print("You have to type in a number"); - } + int userOption; + userOption = nullEscapeAndConvertToInt(); return userOption; } \ No newline at end of file From aee6cabe463772f232cb0e068caf3b3a7845b92e Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 12:37:38 +0000 Subject: [PATCH 25/41] Update check_winner.dart --- lib/functions/check_winner.dart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index aa5badc..f997afe 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -16,5 +16,19 @@ of the user, which should have decreased/increased based on if he won or not. import 'package:BlackJack/functions/functions.dart'; int? CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ + int playerScore = 0; + int houseScore = 0; + for (var item in playerHand) { + playerScore += item; + } + for (var item in houseHand) { + houseScore += item; + } + if (playerScore > houseScore) { + // Win + currentBankRoll += (currentBet * 2); + } else { + currentBankRoll -= currentBet; + } } \ No newline at end of file From 334982c0283413aecf25f79aebca46031c5f2c51 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 13:10:27 +0000 Subject: [PATCH 26/41] Update check_winner.dart --- lib/functions/check_winner.dart | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index f997afe..3d0f1f6 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -16,19 +16,16 @@ of the user, which should have decreased/increased based on if he won or not. import 'package:BlackJack/functions/functions.dart'; int? CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ - int playerScore = 0; - int houseScore = 0; - for (var item in playerHand) { - playerScore += item; - } - for (var item in houseHand) { - houseScore += item; - } - if (playerScore > houseScore) { + + int? playerScore = CalculateScore(playerHand); + int? houseScore = CalculateScore(houseHand); + + if ( playerScore! > houseScore!) { // Win currentBankRoll += (currentBet * 2); } else { currentBankRoll -= currentBet; } + return currentBankRoll; } \ No newline at end of file From 2ca09013b9f23cb66772b1c4b84dc89a71c2e1f5 Mon Sep 17 00:00:00 2001 From: gummi-ice Date: Sat, 21 Oct 2023 13:26:42 +0000 Subject: [PATCH 27/41] Update welcome.dart --- lib/functions/welcome.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions/welcome.dart b/lib/functions/welcome.dart index 5478ebc..9c5d358 100644 --- a/lib/functions/welcome.dart +++ b/lib/functions/welcome.dart @@ -9,5 +9,9 @@ that has no input and simply prints a text. */ void Welcome(){ - + print('************************************************'); + print('Welcome to the BEST BlackJack game OF YOUR LIFE!'); + print('************************************************'); + print('GET READY TO LOSE ALL YOUR MONEY'); + print('************************************************'); } \ No newline at end of file From 70d0d35d40579a108caae17c74df8cd128bdf501 Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 13:28:02 +0000 Subject: [PATCH 28/41] Update money_grab.dart bonus catch non-integer --- lib/functions/money_grab.dart | 47 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/lib/functions/money_grab.dart b/lib/functions/money_grab.dart index 5fb28db..896010c 100644 --- a/lib/functions/money_grab.dart +++ b/lib/functions/money_grab.dart @@ -19,38 +19,33 @@ Can you design the function such that it will ask the user again if he doesn't input a integer? */ -// TEST MAIN FUNCTION -void main(){ - int bankRoll = 1000; - PlaceBet(bankRoll); - - BuyIn(); +int? betLogic(int bankRoll){ + int amount = 0; + try { + amount = int.tryParse(stdin.readLineSync()!) !- 0; + } catch (e){ + print("You have to input a number!"); + betLogic(bankRoll); + } + if (amount > bankRoll){ + print("You can't bet higher than the bankroll, that's currently $bankRoll"); + betLogic(bankRoll); + } else if (amount == 0) { + print("You can't bet 0! Try again."); + betLogic(bankRoll); + } else { + print(amount); + return amount; + } } int? PlaceBet(int bankRoll) { - int amount; print("Give me an amount you want to bet"); - amount = int.parse(stdin.readLineSync().toString()); - if (amount is int) { - if (amount > bankRoll || amount == 0){ - print("Your bet is either zero or larger than the bankroll"); - PlaceBet(bankRoll); - } else { - print(amount); // delete - return amount; - } - } else { - print("That is not an integer"); - PlaceBet(bankRoll); - } - + betLogic(bankRoll); } -int? BuyIn() { - int amount; +int? BuyIn(int bankRoll) { print("How large is your buy in?"); - amount = int.parse(stdin.readLineSync().toString()); - print(amount); - return amount; + betLogic(bankRoll); } From a0ab072b12bbd9e7d38cdde728f9261769b1d078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 13:34:01 +0000 Subject: [PATCH 29/41] house_plays completed --- lib/house_plays.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/house_plays.dart b/lib/house_plays.dart index 8be70b8..780e800 100644 --- a/lib/house_plays.dart +++ b/lib/house_plays.dart @@ -20,5 +20,16 @@ show the score of the house. */ void HousePlays(List houseHand, List deck){ + print('LOG: housePlays started'); + int sumOfHouseHand = houseHand[0]; + int drawnCard; + do { + print("Score of dealer: $sumOfHouseHand"); + drawnCard = DealCard(deck); + houseHand.add(drawnCard); + print("The dealer drew $drawnCard"); + } while (sumOfHouseHand < 17); + + print("LOG: housePlays ended"); } From d5a475478d2cfde1c659cf0cf1c3dd2248300329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 13:53:50 +0000 Subject: [PATCH 30/41] Update house_plays.dart --- lib/house_plays.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/house_plays.dart b/lib/house_plays.dart index 780e800..92065a2 100644 --- a/lib/house_plays.dart +++ b/lib/house_plays.dart @@ -21,7 +21,7 @@ show the score of the house. void HousePlays(List houseHand, List deck){ print('LOG: housePlays started'); - int sumOfHouseHand = houseHand[0]; + int sumOfHouseHand = houseHand[0] + houseHand[1]; int drawnCard; do { From aec5537321dab052d449735d8503bc9409a1573f Mon Sep 17 00:00:00 2001 From: Aronnord <144971443+Aronnord@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:04:45 +0000 Subject: [PATCH 31/41] Update BlackJack.dart --- bin/BlackJack.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/BlackJack.dart b/bin/BlackJack.dart index ac1afc7..4da509a 100644 --- a/bin/BlackJack.dart +++ b/bin/BlackJack.dart @@ -8,6 +8,16 @@ import 'package:BlackJack/functions/deal_card.dart'; */ void main() { -print("test"); + Welcome(); + int bankRoll = 1000; + List?deck = ShuffledDeck(); + List?playerHand = []; + List?houseHand = []; + InitialDeal(playerHand, houseHand, deck); + BuyIn(bankRoll); + PlaceBet(bankRoll); + + + } From 9720b7600c9cd3285fb785ee603023c23ff81819 Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 14:13:31 +0000 Subject: [PATCH 32/41] Update money_grab.dart --- lib/functions/money_grab.dart | 38 +++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/lib/functions/money_grab.dart b/lib/functions/money_grab.dart index 896010c..c3c8b48 100644 --- a/lib/functions/money_grab.dart +++ b/lib/functions/money_grab.dart @@ -20,32 +20,40 @@ he doesn't input a integer? */ -int? betLogic(int bankRoll){ - int amount = 0; +int getInteger(){ + int number = 0; try { - amount = int.tryParse(stdin.readLineSync()!) !- 0; + number = int.tryParse(stdin.readLineSync()!) !- 0; } catch (e){ print("You have to input a number!"); - betLogic(bankRoll); + getInteger(); } - if (amount > bankRoll){ - print("You can't bet higher than the bankroll, that's currently $bankRoll"); - betLogic(bankRoll); + return number; +} + +int PlaceBet(int bankRoll) { + if (bankRoll == 0){ + print("Error: no available funds."); + return 0; + } + print("Give me an amount you want to bet"); + int amount = getInteger(); + if (amount > bankRoll){ + print("You only have $bankRoll to play with! Pick a lower number."); + PlaceBet(bankRoll); + return amount; } else if (amount == 0) { print("You can't bet 0! Try again."); - betLogic(bankRoll); + PlaceBet(bankRoll); + return amount; } else { print(amount); return amount; } } -int? PlaceBet(int bankRoll) { - print("Give me an amount you want to bet"); - betLogic(bankRoll); -} - -int? BuyIn(int bankRoll) { +int BuyIn() { print("How large is your buy in?"); - betLogic(bankRoll); + int amount = getInteger(); + return amount; } From e79207b413fa87583c0dfe4e05c8f9ad03fbb130 Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 14:15:01 +0000 Subject: [PATCH 33/41] Update money_grab.dart --- lib/functions/money_grab.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/functions/money_grab.dart b/lib/functions/money_grab.dart index c3c8b48..603a6a2 100644 --- a/lib/functions/money_grab.dart +++ b/lib/functions/money_grab.dart @@ -34,7 +34,7 @@ int getInteger(){ int PlaceBet(int bankRoll) { if (bankRoll == 0){ print("Error: no available funds."); - return 0; + BuyIn(); } print("Give me an amount you want to bet"); int amount = getInteger(); @@ -47,7 +47,6 @@ int PlaceBet(int bankRoll) { PlaceBet(bankRoll); return amount; } else { - print(amount); return amount; } } From ecd98831f4c0b27cd5184ca4e366273a3d13e9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=C3=B0vald=20Atli=20Sigurvaldsson?= Date: Sat, 21 Oct 2023 14:22:39 +0000 Subject: [PATCH 34/41] status completed --- lib/functions/status.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/functions/status.dart b/lib/functions/status.dart index 38a57af..ae17dca 100644 --- a/lib/functions/status.dart +++ b/lib/functions/status.dart @@ -14,11 +14,18 @@ on what hand he has, his score and the hand of the house. hand before showdown.) */ -List? CardNameList(List playerHand){ - +List CardNameList(List playerHand){ + List output = []; + for(var card in playerHand){ + output.add(CardNamer(card)); + } + return output; } void Status(List playerHand, List houseHand){ - + print("Here is your hand:"); + print(CardNameList(playerHand)); + print("Here is the dealers hand:"); + print(CardNameList(houseHand)); } From 3c5f87fb59532bb2e6a305a7fa4ee4de2f9b6a77 Mon Sep 17 00:00:00 2001 From: Aronnord <144971443+Aronnord@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:37:18 +0000 Subject: [PATCH 35/41] blackjack --- bin/BlackJack.dart | 28 ++++++++++++++++++---------- lib/functions/check_if_busted.dart | 14 +++++--------- lib/functions/check_winner.dart | 17 +++++++++++++++-- lib/functions/shuffled_deck.dart | 6 +++--- lib/functions/status.dart | 10 ++++++++-- lib/hit_or_stay.dart | 15 +++++++++++---- lib/house_plays.dart | 20 +++++++++++++++++--- 7 files changed, 77 insertions(+), 33 deletions(-) diff --git a/bin/BlackJack.dart b/bin/BlackJack.dart index 4da509a..8efc431 100644 --- a/bin/BlackJack.dart +++ b/bin/BlackJack.dart @@ -9,15 +9,23 @@ import 'package:BlackJack/functions/deal_card.dart'; void main() { Welcome(); - int bankRoll = 1000; - List?deck = ShuffledDeck(); - List?playerHand = []; - List?houseHand = []; - InitialDeal(playerHand, houseHand, deck); - BuyIn(bankRoll); - PlaceBet(bankRoll); - - - + int? bankRoll = BuyIn(); + while(bankRoll! > 0) { + List?deck = ShuffledDeck(); + List?playerHand = []; + List?houseHand = []; + InitialDeal(playerHand, houseHand, deck); + int? bet = PlaceBet(bankRoll); + DealCard(deck); + HitOrStay(playerHand, houseHand, deck); + if (CheckIfBusted(playerHand) == true) { + CheckWinner(playerHand, houseHand, bankRoll, bet); + } else { + HousePlays(houseHand, deck); + } + // Status(playerHand, houseHand); + bankRoll = CheckWinner(playerHand, houseHand, bankRoll, bet); + print(bankRoll); + } } diff --git a/lib/functions/check_if_busted.dart b/lib/functions/check_if_busted.dart index 742adf6..0f6a119 100644 --- a/lib/functions/check_if_busted.dart +++ b/lib/functions/check_if_busted.dart @@ -22,14 +22,10 @@ Example inputs if ... true eða false, return true eða false */ -bool? CheckIfBusted(List hand){ - int sumOfCards = 0; - for(int card in hand){ - sumOfCards += card; - - if(sumOfCards > 21){ - return false; - } +bool CheckIfBusted(List hand){ + int? sumOfCards = CalculateScore(hand); + if(sumOfCards! > 21){ + return true; } - return true; + return false; } \ No newline at end of file diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index 3d0f1f6..7a86517 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -21,11 +21,24 @@ int? CheckWinner(List playerHand, List houseHand, int currentBankRoll, int? playerScore = CalculateScore(playerHand); int? houseScore = CalculateScore(houseHand); - if ( playerScore! > houseScore!) { + if(CheckIfBusted(houseHand)){ + // WIN + currentBankRoll += currentBet; + } else { + if ( playerScore! > houseScore! && CheckIfBusted(playerHand) == false && CheckIfBusted(houseHand)) { + // Win + currentBankRoll += currentBet; + } else { + currentBankRoll -= currentBet; + } + } +/* + if ( playerScore! > houseScore! && CheckIfBusted(playerHand) == false && CheckIfBusted(houseHand)) { // Win currentBankRoll += (currentBet * 2); } else { currentBankRoll -= currentBet; - } + }*/ + ShowAllCards(playerHand, houseHand); return currentBankRoll; } \ No newline at end of file diff --git a/lib/functions/shuffled_deck.dart b/lib/functions/shuffled_deck.dart index 065d2ba..f0e9303 100644 --- a/lib/functions/shuffled_deck.dart +++ b/lib/functions/shuffled_deck.dart @@ -8,10 +8,10 @@ Shuffler And when run, returns a shuffled deck of cards. No inputs, only output. */ -List? ShuffledDeck(){ - List? _shuffledDeck = Shuffler(DeckOfCards()); +List ShuffledDeck(){ + List _shuffledDeck = Shuffler(DeckOfCards())!; print("A deck of cards has been shuffled"); - print('Log - shuffled-deck: ${_shuffledDeck}'); + //print('Log - shuffled-deck: ${_shuffledDeck}'); return _shuffledDeck; } \ No newline at end of file diff --git a/lib/functions/status.dart b/lib/functions/status.dart index ae17dca..1ec1a1b 100644 --- a/lib/functions/status.dart +++ b/lib/functions/status.dart @@ -17,7 +17,7 @@ hand before showdown.) List CardNameList(List playerHand){ List output = []; for(var card in playerHand){ - output.add(CardNamer(card)); + output.add(CardNamer(card)!); } return output; } @@ -26,6 +26,12 @@ void Status(List playerHand, List houseHand){ print("Here is your hand:"); print(CardNameList(playerHand)); print("Here is the dealers hand:"); - print(CardNameList(houseHand)); + print(CardNamer(houseHand[0])); } +void ShowAllCards(List playerHand, List houseHand){ + print("Here is your hand:"); + print(CardNameList(playerHand)); + print("Here is the dealers hand:"); + print(CardNameList(houseHand)); +} diff --git a/lib/hit_or_stay.dart b/lib/hit_or_stay.dart index 9504ea4..42820c1 100644 --- a/lib/hit_or_stay.dart +++ b/lib/hit_or_stay.dart @@ -30,15 +30,22 @@ void HitOrStay(List playerHand, List houseHand, List deck){ int? userRequest = null; int? drawnCard = null; - while(userRequest != 2 || CheckIfBusted(playerHand) == false){ + while(userRequest != 3 || CheckIfBusted(playerHand) == false){ + Status(playerHand, houseHand); userRequest = OptionSelect('Pick an option:', options); - if(userRequest == 0){ // Hit + if(userRequest == 1){ // Hit drawnCard = DealCard(deck); print("You have drawn: $drawnCard"); - } else if(userRequest == 1 ){ + playerHand.add(drawnCard); + if(CheckIfBusted(playerHand)){ + print("You busted"); + Status(playerHand, houseHand); + return; + } + } else if(userRequest == 2 ){ print("You have selected Stay"); // Stay return; - } else if(userRequest == 2){ // Quit + } else if(userRequest == 3){ // Quit return; } else { print("Not a valid option."); diff --git a/lib/house_plays.dart b/lib/house_plays.dart index 92065a2..3abe35f 100644 --- a/lib/house_plays.dart +++ b/lib/house_plays.dart @@ -21,15 +21,29 @@ show the score of the house. void HousePlays(List houseHand, List deck){ print('LOG: housePlays started'); - int sumOfHouseHand = houseHand[0] + houseHand[1]; + print("Before drawing score: ${CalculateScore(houseHand)}"); + int? sumOfHouseHand = houseHand[0] + houseHand[1]; int drawnCard; + while(sumOfHouseHand! < 17){ + print("Score of dealer: $sumOfHouseHand"); + drawnCard = DealCard(deck); + houseHand.add(drawnCard); + print("The dealer drew ${CardNamer(drawnCard)}"); + //sumOfHouseHand += drawnCard; + sumOfHouseHand = CalculateScore(houseHand); + } + /* do { print("Score of dealer: $sumOfHouseHand"); drawnCard = DealCard(deck); houseHand.add(drawnCard); - print("The dealer drew $drawnCard"); - } while (sumOfHouseHand < 17); + print("The dealer drew ${CardNamer(drawnCard)}"); + //sumOfHouseHand += drawnCard; + sumOfHouseHand = CalculateScore(houseHand); + } while (sumOfHouseHand! < 17); + */ + print("Dealer score: $sumOfHouseHand"); print("LOG: housePlays ended"); } From 33ce955f5ba27b81607b701db170a3051968c1c6 Mon Sep 17 00:00:00 2001 From: Aronnord <144971443+Aronnord@users.noreply.github.com> Date: Sat, 21 Oct 2023 15:50:11 +0000 Subject: [PATCH 36/41] black jack 2.0 --- .idea/libraries/Dart_SDK.xml | 40 +++++++++++++++++++----------------- lib/house_plays.dart | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 1fdc1a3..cd79524 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,27 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/house_plays.dart b/lib/house_plays.dart index 3abe35f..21a06e0 100644 --- a/lib/house_plays.dart +++ b/lib/house_plays.dart @@ -22,7 +22,7 @@ show the score of the house. void HousePlays(List houseHand, List deck){ print('LOG: housePlays started'); print("Before drawing score: ${CalculateScore(houseHand)}"); - int? sumOfHouseHand = houseHand[0] + houseHand[1]; + int? sumOfHouseHand = CalculateScore(houseHand); int drawnCard; while(sumOfHouseHand! < 17){ From 1362ab8d1878fe0d5d91bd93d0e87a926cc4434b Mon Sep 17 00:00:00 2001 From: bjornunnar Date: Sat, 21 Oct 2023 15:52:06 +0000 Subject: [PATCH 37/41] Update check_winner.dart --- lib/functions/check_winner.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index 7a86517..9b02110 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -28,17 +28,12 @@ int? CheckWinner(List playerHand, List houseHand, int currentBankRoll, if ( playerScore! > houseScore! && CheckIfBusted(playerHand) == false && CheckIfBusted(houseHand)) { // Win currentBankRoll += currentBet; + print("You Win!"); } else { currentBankRoll -= currentBet; + print("You Lose!"); } } -/* - if ( playerScore! > houseScore! && CheckIfBusted(playerHand) == false && CheckIfBusted(houseHand)) { - // Win - currentBankRoll += (currentBet * 2); - } else { - currentBankRoll -= currentBet; - }*/ ShowAllCards(playerHand, houseHand); return currentBankRoll; } \ No newline at end of file From 0c0fd564d4ddba4a24cb39eaa63a19a2faa14a54 Mon Sep 17 00:00:00 2001 From: Hjalti Unnar Agustsson Date: Sat, 21 Oct 2023 16:11:19 +0000 Subject: [PATCH 38/41] commit --- bin/BlackJack.dart | 23 +++++++++++++++++++++++ lib/functions/check_winner.dart | 22 ++++++++++++++++++++++ lib/functions/score_function.dart | 20 ++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/bin/BlackJack.dart b/bin/BlackJack.dart index f527eab..6e4958a 100644 --- a/bin/BlackJack.dart +++ b/bin/BlackJack.dart @@ -8,6 +8,29 @@ import 'package:BlackJack/functions/deal_card.dart'; */ void main() { +<<<<<<< Updated upstream +======= + Welcome(); + int? bankRoll = BuyIn(); + while(bankRoll! > 0) { + List?deck = ShuffledDeck(); + List?playerHand = []; + List?houseHand = []; + InitialDeal(playerHand, houseHand, deck); + int? bet = PlaceBet(bankRoll); + //DealCard(deck); + HitOrStay(playerHand, houseHand, deck); + if (CheckIfBusted(playerHand) == true) { + CheckWinner(playerHand, houseHand, bankRoll, bet); + } else { + HousePlays(houseHand, deck); + } + // Status(playerHand, houseHand); + bankRoll = CheckWinner(playerHand, houseHand, bankRoll, bet); + print(bankRoll); + //returnHands() + } +>>>>>>> Stashed changes } diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index d01e38d..47ebfe6 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -17,4 +17,26 @@ import 'package:BlackJack/functions/functions.dart'; int CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ +<<<<<<< Updated upstream +======= + + int? playerScore = CalculateScore(playerHand); + int? houseScore = CalculateScore(houseHand); + + if(CheckIfBusted(houseHand)){ + // WIN + currentBankRoll += currentBet; + } else { + if ( playerScore! > houseScore! && CheckIfBusted(playerHand) == false) { + // Win + currentBankRoll += currentBet; + print("You Win!"); + } else { + currentBankRoll -= currentBet; + print("You Lose!"); + } + } + ShowAllCards(playerHand, houseHand); + return currentBankRoll; +>>>>>>> Stashed changes } \ No newline at end of file diff --git a/lib/functions/score_function.dart b/lib/functions/score_function.dart index 12e7e97..8d7710c 100644 --- a/lib/functions/score_function.dart +++ b/lib/functions/score_function.dart @@ -21,7 +21,27 @@ gets the score 1. So if the method gets the hand [1, 1] the score would be 12 hand = [7, 1] -> Score 18 */ +<<<<<<< Updated upstream int CalculateScore(List hand){ +======= +int? CalculateScore(List hand){ + int sum = 0; + bool checkIfAce = false; + for (int number in hand) { + if (number == 1 && checkIfAce == false){ + checkIfAce = true; + sum += 11; + } else if (number == 1 && checkIfAce == true) { + sum += 1; + } else if(number >= 2 && number <= 10) { + sum += number; + } else if (number >= 11 && number <= 13){ + sum += 10; + } + } + print('sum: $sum'); + return sum; +>>>>>>> Stashed changes } From 05189302e812d2e83bfcbc4a0e17234fe14cc2a5 Mon Sep 17 00:00:00 2001 From: Hjalti Unnar Agustsson Date: Sat, 21 Oct 2023 16:11:58 +0000 Subject: [PATCH 39/41] Update BlackJack.dart --- bin/BlackJack.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/BlackJack.dart b/bin/BlackJack.dart index 6e4958a..26d4f73 100644 --- a/bin/BlackJack.dart +++ b/bin/BlackJack.dart @@ -8,9 +8,6 @@ import 'package:BlackJack/functions/deal_card.dart'; */ void main() { -<<<<<<< Updated upstream - -======= Welcome(); int? bankRoll = BuyIn(); while(bankRoll! > 0) { @@ -31,6 +28,5 @@ void main() { print(bankRoll); //returnHands() } ->>>>>>> Stashed changes } From a62a1b2b1da5bfc4164ee479af4a753892d0a040 Mon Sep 17 00:00:00 2001 From: Hjalti Unnar Agustsson Date: Sat, 21 Oct 2023 16:12:17 +0000 Subject: [PATCH 40/41] Update check_winner.dart --- lib/functions/check_winner.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/functions/check_winner.dart b/lib/functions/check_winner.dart index 47ebfe6..42f6bb2 100644 --- a/lib/functions/check_winner.dart +++ b/lib/functions/check_winner.dart @@ -17,9 +17,6 @@ import 'package:BlackJack/functions/functions.dart'; int CheckWinner(List playerHand, List houseHand, int currentBankRoll, int currentBet){ -<<<<<<< Updated upstream -======= - int? playerScore = CalculateScore(playerHand); int? houseScore = CalculateScore(houseHand); @@ -38,5 +35,4 @@ int CheckWinner(List playerHand, List houseHand, int currentBankRoll, } ShowAllCards(playerHand, houseHand); return currentBankRoll; ->>>>>>> Stashed changes -} \ No newline at end of file +} From c2b551305e4cf71e8d067404631f26b1c4af7ccc Mon Sep 17 00:00:00 2001 From: Hjalti Unnar Agustsson Date: Sat, 21 Oct 2023 16:12:39 +0000 Subject: [PATCH 41/41] Update score_function.dart --- lib/functions/score_function.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/functions/score_function.dart b/lib/functions/score_function.dart index 8d7710c..d9603aa 100644 --- a/lib/functions/score_function.dart +++ b/lib/functions/score_function.dart @@ -21,10 +21,6 @@ gets the score 1. So if the method gets the hand [1, 1] the score would be 12 hand = [7, 1] -> Score 18 */ -<<<<<<< Updated upstream -int CalculateScore(List hand){ - -======= int? CalculateScore(List hand){ int sum = 0; bool checkIfAce = false; @@ -42,6 +38,5 @@ int? CalculateScore(List hand){ } print('sum: $sum'); return sum; ->>>>>>> Stashed changes }