Skip to content

Instantly share code, notes, and snippets.

View andrewljohnson's full-sized avatar

Andrew L. Johnson andrewljohnson

View GitHub Profile
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// Current Cards
// Mountain
// Future Cards
void groupDefenders(vector<vector<int>> attackers, vector<int> defenders, int i) {
int x = 0;
for (vector<int> attackerBucket:attackers) {
cout << x << ": ";
for (int defender:attackerBucket) {
cout << defender << " ";
}
cout << "\n";
x+= 1;
}
/*
This method prints all possible blocks, recursively.
For example, if you have blockers A & B, and attacker C, there are three posible blocks.
No blockers:
A:
B:
C blocks A:
/*
Print out all ways for attackers to be blocked. blockAssignments maps ids of attackers to
vectors of defender ids for which blocks have already been chosen. defenders/defendersIterator specify
defenders that could block any of the attackers. This method iterates over all ways to choose blocks for
the remaining defenders.
example input: groupDefenders({0:[2 3] 1:[4 5]}, [6 7 8 9], 3)
output:
from segments.huggingface import release2dataset
from segments import SegmentsClient
dataset_identifier = "andrewljohnson/magic_cards"
release_name = "v0.1"
api_key = "HIDDEN"
client = SegmentsClient(api_key) # this is different from blog, blog seemed outdated
release = client.get_release(dataset_identifier, release_name)
hf_dataset = release2dataset(release)
from segments.utils import get_semantic_bitmap
from bs4 import BeautifulSoup
import pandas as pd
with open('magiccon.html', 'r', encoding='utf-8') as file:
html_data = file.read()
soup = BeautifulSoup(html_data, 'html.parser')
# Initialize lists to store data
data = {
'Title': [],