/
app.py
75 lines (59 loc) · 2.13 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# ============================================================================
# Author: Rodolfo Ferro
# Twitter: @rodo_ferro
#
# Script: Main app. [WIP - Work In Progress]
#
# ABOUT COPYING OR USING PARTIAL INFORMATION:
# This script was originally created by Rodolfo Ferro. Any
# explicit usage of this script or its contents is granted
# according to the license provided and its conditions.
# ============================================================================
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import streamlit as st
from pokemontcgsdk import RestClient
from pokemontcgsdk import Set
from pokemontcgsdk import Card
from tools import parse_deck_from_tcgo
from tools import parse_raw_to_info
from tools import durstenfeld
from card import PokeCard
# ============================================================================
# Pokémon TCG SDK Config
# ============================================================================
API_KEY = "c2ed168e-f9bf-4c75-b975-d66fdc28c404"
RestClient.configure(API_KEY)
# ============================================================================
# Sidebar
# ============================================================================
raw_deck = st.sidebar.text_area(
"Introduce your deck as exported from Pokémon TCGO:",
height=300
)
if st.sidebar.button("Simulate"):
pokemon_raw, trainer_raw, energy_raw = parse_deck_from_tcgo(raw_deck)
pokemon_info = parse_raw_to_info(pokemon_raw)
trainer_info = parse_raw_to_info(trainer_raw)
energy_info = parse_raw_to_info(energy_raw)
st.markdown(pokemon_info)
# ============================================================================
# Main View
# ============================================================================
st.markdown("""
# Pokéhandy – Pokémon Hand Simulator
This application aims to simulate the hand of a Pokémon TCG player.
""")
st.markdown("""
### Card shuffling simulation for A-Z cards.
""")
cards_list = [chr(i) for i in range(65, 91)]
st.markdown(f"""
#### Ordered cards
{cards_list}
""")
shuffled_cards = durstenfeld(cards_list)
st.markdown(f"""
#### Shuffled cards
{shuffled_cards}
""")