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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/Dart_Functions_BlackJack_Stripped.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/BlackJack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import 'package:BlackJack/functions/deal_card.dart';
*/

void main() {

CalculateScore([1,1,1,12]);
}

2 changes: 1 addition & 1 deletion lib/functions/card_namer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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){

}
15 changes: 12 additions & 3 deletions lib/functions/check_if_busted.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:BlackJack/functions/draw_card.dart';

import 'score_function.dart';

/*
Create a function called CheckIfBusted.

Expand All @@ -23,6 +22,16 @@ if ... true eða false, return true eða false
*/


bool CheckIfBusted(List<int> hand){
bool? CheckIfBusted(List<int> hand) {

}
int? score= 0;
score = CalculateScore(hand);
bool busted = false;
if (score > 21){
busted = true;
}
else {
busted = false;
}
return busted;
}
2 changes: 1 addition & 1 deletion lib/functions/check_winner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> playerHand, List<int> houseHand, int currentBankRoll, int currentBet){
int? CheckWinner(List<int> playerHand, List<int> houseHand, int currentBankRoll, int currentBet){

}
2 changes: 1 addition & 1 deletion lib/functions/deal_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ print(deck); // Should print [2, 3, 4]

*/

int DealCard(List<int> deck){
int? DealCard(List<int> deck){

}
2 changes: 1 addition & 1 deletion lib/functions/deck_of_cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ the number 2 four times etc...
Make this function return the List of integers.
*/

List<int> DeckOfCards() {
List<int>? DeckOfCards() {
List<int> Cards = [];
List<int> Deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
List<String> Suits = ["Spaði", "Tígul", "Hjarta", "Lauf"];
Expand Down
4 changes: 2 additions & 2 deletions lib/functions/money_grab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

}
2 changes: 1 addition & 1 deletion lib/functions/option_select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ that the function will simply ask the user again to input an answer?

*/

int OptionSelect(String statement, List<String> options) {
int? OptionSelect(String statement, List<String> options) {

}
19 changes: 17 additions & 2 deletions lib/functions/score_function.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,23 @@ gets the score 1. So if the method gets the hand [1, 1] the score would be 12
hand = [11, 13] -> Score 20
hand = [7, 1] -> Score 18
*/
// firstAce = 13;
// followUpAce = 1;

int CalculateScore(List<int> hand){

int result = 0;
bool isAce = false;
hand.forEach((element) {
if (element > 10) {
element = 10;
}
if (element == 1 && isAce == false){
element = 11;
isAce = true;
} else if(element == 1 && isAce == true) {
element = 1;
}
result += element;
});
return result;
}

2 changes: 1 addition & 1 deletion lib/functions/shuffled_deck.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Shuffler
And when run, returns a shuffled deck of cards. No inputs, only output.
*/

List<int> ShuffledDeck(){
List<int>? ShuffledDeck(){

}
2 changes: 1 addition & 1 deletion lib/functions/shuffler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ and outputs a shuffled list of integers.
I.e, it should return a RANDOMIZED version of the list.
*/

List<int> Shuffler(List<int> theList){
List<int>? Shuffler(List<int> theList){

}
2 changes: 1 addition & 1 deletion lib/functions/status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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){

}

Expand Down
Loading