diff --git a/16pix_gen/main.py b/16pix_gen/main.py index 4e62e8b..217c443 100644 --- a/16pix_gen/main.py +++ b/16pix_gen/main.py @@ -4,11 +4,11 @@ from PIL import Image import random import pprint -IMAGE_LENGTH = 32 +IMAGE_LENGTH = 16 NUM_COLOURS = 3 def generate_array(colours): - array = [[9]*IMAGE_LENGTH for _ in range(IMAGE_LENGTH+1)] + array = [[(0, 0, 0)]*IMAGE_LENGTH for _ in range(IMAGE_LENGTH+1)] for i in range(IMAGE_LENGTH): for j in range(IMAGE_LENGTH): array[j][i] = random.choice(colours) diff --git a/card_stuffs/.gitignore b/card_stuffs/.gitignore new file mode 100644 index 0000000..77524ba --- /dev/null +++ b/card_stuffs/.gitignore @@ -0,0 +1,15 @@ +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ +test_files/all-cards.json + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html +Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb diff --git a/card_stuffs/Cargo.lock b/card_stuffs/Cargo.lock new file mode 100644 index 0000000..ce83047 --- /dev/null +++ b/card_stuffs/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "card_stuffs" +version = "0.1.0" diff --git a/card_stuffs/Cargo.toml b/card_stuffs/Cargo.toml new file mode 100644 index 0000000..c54b0fa --- /dev/null +++ b/card_stuffs/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "card_stuffs" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/card_stuffs/src/lib.rs b/card_stuffs/src/lib.rs new file mode 100644 index 0000000..9e5e7e4 --- /dev/null +++ b/card_stuffs/src/lib.rs @@ -0,0 +1,64 @@ +pub enum Suit { + Heart, + Diamond, + Club, + Spade +} + +pub enum Value { + Ace, + Two, + Three, + Four, + Five, + Six, + Seven, + Eight, + Nine, + Ten, + Jack, + Queen, + King +} + +impl Value { + pub fn indexed_values(&self) -> u8 { + match *self { + Value::Ace => 1, + Value::Two => 2, + Value::Three => 3, + Value::Four => 4, + Value::Five => 5, + Value::Six => 6, + Value::Seven => 7, + Value::Eight => 8, + Value::Nine => 9, + Value::Ten => 10, + Value::Jack => 11, + Value::Queen => 12, + Value::King => 13, + } + } +} + +pub struct Card { + pub suit: Suit, + pub value: Value, +} + + + +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +}