add more code for 54 (WIP)

This commit is contained in:
Dr. Matthias Ratajczak
2022-08-17 21:09:35 +02:00
parent 3d3170117c
commit 1dbc0052ca
+17 -2
View File
@@ -1,5 +1,4 @@
#![allow(dead_code, unused_imports)] #![allow(dead_code, unused_imports)]
use std::{ use std::{
cmp::max, cmp::max,
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
@@ -73,6 +72,22 @@ enum Value {
Ace, Ace,
} }
const VALUES: [Value; 13] = [
Value::Two,
Value::Three,
Value::Four,
Value::Five,
Value::Six,
Value::Seven,
Value::Eight,
Value::Nine,
Value::Ten,
Value::Jack,
Value::Queen,
Value::King,
Value::Ace,
];
impl Value { impl Value {
fn from_char(c: char) -> Self { fn from_char(c: char) -> Self {
match c { match c {
@@ -185,7 +200,7 @@ impl CardTrait for Cards {
} }
fn have_consecutive_values(&self) -> bool { fn have_consecutive_values(&self) -> bool {
self[0].value + 1 VALUES.
} }
} }