Skip to content

Commit

Permalink
Update spread, add default spreads
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarcederberg committed Jul 29, 2021
1 parent c241b78 commit df0a6f3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
8 changes: 3 additions & 5 deletions Classes/ISpread.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System.Collections.Generic;

namespace tarot{
public interface ISpread<T> where T : ICard{
public void AddCards(IEnumerable<T> cards);
public interface ISpread<T, U> where T : IDeck<U> where U : ICard {
public void AddCards(T deck);

public string SerializeSpread();

public void PrintSpread();

public int Size();
public int GetLength();
}
}
28 changes: 16 additions & 12 deletions Classes/TarotSpread.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
using System;
using System.Collections.Generic;

namespace tarot{
public class TarotSpread : ISpread<TarotCard>{
private List<TarotCard> _spread;
public class TarotSpread : ISpread<TarotDeck, TarotCard>{
private TarotCard[] _spread_cards;
private string[] _spread_positions;

public TarotSpread(){
this._spread = new List<TarotCard>();
public TarotSpread(string[] positions, TarotDeck deck){
this._spread_positions = positions;
this._spread_cards = new TarotCard[GetLength()];
AddCards(deck);
}

public void AddCards(IEnumerable<TarotCard> cards){
this._spread.AddRange(cards);
public void AddCards(TarotDeck deck){
for (int i = 0; i < GetLength(); i++){
this._spread_cards[i] = deck.RequeueCard();
}
}

public string SerializeSpread(){
return Utilities.Serialize<List<TarotCard>>(this._spread);
return Utilities.Serialize<TarotCard[]>(this._spread_cards);
}

public void PrintSpread(){
foreach(TarotCard card in this._spread){
Console.WriteLine(card.ToString());
for (int i = 0; i < GetLength(); i++){
Console.WriteLine($"{i}. {_spread_positions[i]}:\n\t{_spread_cards[i]}");
}
}

public int Size(){
return _spread.Count;
public int GetLength(){
return _spread_positions.Length;
}
}
}
21 changes: 21 additions & 0 deletions Data/default_spreads.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Linear 3 Card Spread": [
"Past, you, situation, idea",
"Present, your path/relationship, action, process",
"Future, your potential/partner, outcome, aspiration"
],
"Making Decisions": [
"Your motivation",
"Ideal outcome",
"Your values",
"Option 1, likely outcome",
"Option 2, likely outcome"
],
"Hierarchy of Needs": [
"Physiological",
"Safety",
"Love and belonging",
"Esteem",
"Self-actualization"
]
}

0 comments on commit df0a6f3

Please sign in to comment.