Create a class with 2 methods:
- roll(self, pins)
- score(self)
The rules for scoring are as follows
- A game is 10 frames
- Each frame can have up to 2 rolls
- A spare is when you knock down all pins in a frame
use std::collections::HashMap; | |
use futures::{stream, StreamExt}; | |
use reqwest::Client; | |
use serde::{Deserialize, Serialize}; | |
use std::error::Error; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct ProjectsItem { | |
hash_id: String, |
#!/usr/bin/env bash | |
set -euo pipefail | |
CACHE_DIR="${XDG_CACHE_HOME:-$HOME/Library/Caches}/wrapper-1password" | |
CACHE_FILE="$CACHE_DIR/session-token.yaml" | |
OP_LOCATION="$(command -v op)" | |
mkdir -p "$CACHE_DIR" |
#!/usr/bin/env fish | |
# You can do something similar in fish too | |
function gfmfmt | |
for I in $argv | |
set -lx TEMPORARY_FILE (mktemp -d)"/"(basename "$I") | |
pandoc --from=gfm --to=gfm --wrap=auto "$I" > "$TEMPORARY_FILE" | |
mv "$TEMPORARY_FILE" "$I" | |
end |
// Create an object with hollow methods (does not need to implement everything) | |
const myTestDouble = { | |
exampleMethod: (): any => { | |
} | |
} as RealClass; | |
// Then to return something | |
spyOn(myTestDouble, 'exampleMethod').and.returnValue("Stubbed Value"); |
You've just created a virtual vending machine that will dispense widgets of programming goodness when a user puts money into the machine. The machine should dispense the proper change. You now need the programming logic to determine which coins to dispense.
Write a program that will correctly determine the least number of coins to be given to the user such that the sum of the coins' value would equal the correct amount of change.