public void SingleDeckTotalValue() { deck Deck = new deck(1); int InitialCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Assert.AreEqual(InitialCardTotal, 364); }
void Awake() //varaibles to initiate only one time for scene { instance = this; //this script left_time = bonus_time; int_time = -1; GenerateCardDeckSprite();//fuse clubs[], spades[], diamonds[] and hearts[] in one array //setup deck sprite GetComponent <Image> ().sprite = card_back_sprite; new_card_anim.transform.GetChild(0).transform.GetChild(0).GetComponent <Image> ().sprite = card_back_sprite; animation_duration = new_card_anim.GetComponent <Animation> ().GetClip("new_card_anim").length; undo_animation_duration = new_card_anim.GetComponent <Animation> ().GetClip("undo_to_deck_card_anim").length; if (PyramidMenu.GetInstance().endDialog_moveAnimator.gameObject.activeSelf) { popup_animation_duration = PyramidMenu.GetInstance().endDialog_moveAnimator.GetCurrentAnimatorClipInfo(0).Length; } gpend_button.interactable = false; mustEnableEndButton = false; mustEnableDeckImage = false; total_card_on_board = 0; //Debug.Log ("board cards = " + total_card_on_board + " ...max same rank = " + max_number_of_card_with_the_same_rank_on_board); }
public unsafe deck fillDeck(deck tofill) { for (int i = 0; i < deck.getSize(); i++) { Carte carte = deck.getElem(i); tofill.couleur[i] = Convert.ToChar(carte.getCouleur()); tofill.value[i] = Convert.ToInt32(carte.getType()); } return(tofill); }
public void ShuffleValue() { deck Deck = new deck(1); int InitialCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Deck.Cards.Shuffle(); int ShuffledCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Assert.AreEqual(InitialCardTotal, ShuffledCardTotal); }
public Boolean delete(Int32 id) { deck de = db.decks.Where(x => x.id == id).Single(); db.decks.DeleteOnSubmit(de); db.SubmitChanges(); return(true); }
void Advanced() { deck my_target = (deck)target; EditorGUI.BeginChangeCheck(); Undo.RecordObject(my_target, "edit_advanced"); my_target.editor_show_advanced = EditorGUILayout.Foldout(my_target.editor_show_advanced, "Advanced"); if (my_target.editor_show_advanced) { EditorGUI.indentLevel++; my_target.editor_show_gui = EditorGUILayout.Foldout(my_target.editor_show_gui, "GUI"); if (my_target.editor_show_gui) { EditorGUI.indentLevel++; my_target.show_win_or_lose_screen_after_delay = EditorGUILayout.FloatField("show gameOver screen after", my_target.show_win_or_lose_screen_after_delay); my_target.hide_win_or_lose_screen_after_delay = EditorGUILayout.FloatField("exit gameOver screen after", my_target.hide_win_or_lose_screen_after_delay); EditorGUI.indentLevel++; my_target.score_text = EditorGUILayout.ObjectField("score text", my_target.score_text, typeof(Text), true) as Text; my_target.bonus_text = EditorGUILayout.ObjectField("bonus text", my_target.bonus_text, typeof(Text), true) as Text; my_target.combo_text = EditorGUILayout.ObjectField("combo text", my_target.combo_text, typeof(Text), true) as Text; my_target.deck_card_left_text = EditorGUILayout.ObjectField("deck card left text", my_target.deck_card_left_text, typeof(Text), true) as Text; my_target.undo_button = EditorGUILayout.ObjectField("undo button", my_target.undo_button, typeof(Button), true) as Button; my_target.gpend_button = EditorGUILayout.ObjectField("gpend button", my_target.gpend_button, typeof(Button), true) as Button; EditorGUI.indentLevel--; EditorGUI.indentLevel++; my_target.final_score = EditorGUILayout.ObjectField("Final Score", my_target.final_score, typeof(Text), true) as Text; my_target.final_bonus_score = EditorGUILayout.ObjectField("Final Bonus Score", my_target.final_bonus_score, typeof(Text), true) as Text; my_target.final_total_score = EditorGUILayout.ObjectField("Final Total Score", my_target.final_total_score, typeof(Text), true) as Text; EditorGUI.indentLevel--; EditorGUI.indentLevel--; } EditorGUILayout.Space(); my_target.ghost_card = EditorGUILayout.ObjectField("ghost card", my_target.ghost_card, typeof(Transform), true) as Transform; my_target.board = EditorGUILayout.ObjectField("board", my_target.board, typeof(Transform), true) as Transform; my_target.target_new_card = EditorGUILayout.ObjectField("target_new_card", my_target.target_new_card, typeof(Image), true) as Image; my_target.new_card_anim_sprite = EditorGUILayout.ObjectField("new_card_anim_sprite", my_target.new_card_anim_sprite, typeof(Image), true) as Image; my_target.new_card_anim = EditorGUILayout.ObjectField("new_card_anim", my_target.new_card_anim, typeof(Animation), true) as Animation; EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(my_target); } }
public Deck update(Deck d) { deck de = db.decks.Where(x => x.id == d.id).Single(); de.description = d.description; de.event_id = d.event_id; de.title = d.title; db.SubmitChanges(); return(d); }
public int print_deck(deck deck) { int i = 0; for (int k = 0; k < 8; k++) { if (deck.value[k] != -1) { Console.WriteLine(k + "em carte est un(e) " + (Type)deck.value[k] + " de " + (Couleur)deck.couleur[k]); i = i + 1; } } return(i); }
//Deck Constructor public Deck(ref deck dStruct) { DStruct = dStruct; suits = new Card.Suit[Constants.NO_OF_SUITS]; values = new Card.Value[Constants.NO_OF_CARD_VALUES]; for (int i = 0; i < Constants.NO_OF_SUITS; i++) { suits[i] = new Game.Deck.Card.Suit(DeckStruct.suits[i]); } for (int i = 0; i < Constants.NO_OF_CARD_VALUES; i++) { values[i] = new Game.Deck.Card.Value(DeckStruct.values[i]); } }//end default Deck constructor
void Sfx() { deck my_target = (deck)target; EditorGUI.BeginChangeCheck(); Undo.RecordObject(my_target, "edit_sfx"); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(my_target); } EditorGUILayout.Space(); }
public void MultiDeckTotalValue() { deck Deck = new deck(2); int InitialCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Assert.AreEqual(InitialCardTotal, (364 * 2)); Deck = new deck(3); InitialCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Assert.AreEqual(InitialCardTotal, (364 * 3)); Deck = new deck(4); InitialCardTotal = CardExploration.extensions.extensions.CardTotal(Deck.Cards); Assert.AreEqual(InitialCardTotal, (364 * 4)); }
public Deck create(Deck d) { deck de = new deck(); de.description = d.description; de.event_id = d.event_id; de.title = d.title; db.decks.InsertOnSubmit(de); db.SubmitChanges(); d.id = de.id; return(d); }
static void Main(string[] args) { Console.ReadLine(); //Write Start Time Task.Run(() => TimeRecordManager.RecordTime("startTime")); string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); deck Deck = new deck(1); IApproximator Qfunc = new LinearApproximator(10, 2); IExplorationPolicy Policy = new RQlearning(0.0001, 0.99, Qfunc); PlayerAction Actions = new PlayerAction(); Agent player = new Agent(Policy); using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "learning rate.csv"))) { for (int i = 0; i < 10000; i++) { // Single deck game instance Game game = new Game(1); IGameState <card> initial = game.NewRound(0); long counter = 0; while (initial.Reward > 0.0) { int action = player.MakeDecision(initial.GetState(), Enum.GetValues(Actions.GetType()).Cast <int>()); initial = game.Transition(action); player.UpdatePolicy(initial.GetState(), action, initial.Reward); counter++; } //Player Score outputFile.WriteLine(counter.ToString()); Console.WriteLine("Number of Rounds " + counter.ToString()); } } //Write End Time /* Task.Run(() => TimeRecordManager.RecordTime("endTime"));*/ Console.ReadLine(); /// /// |----Agent------| /// | | /// |--Environment--| /// /// Passing State and Reward to Agent in return for Action Passed to Environment }
// Start is called before the first frame update void Start() { if (instance != null) { Destroy(this.gameObject); return; } decklist = new List <int>(); bosslist = new List <int>(); additionalDecklist = new List <int>(); bossDecklist = new List <int>(); initialdeck(); initialboss(); initialadd(); initialbossdeck(); instance = this; DontDestroyOnLoad(this); }
void Rules() { deck my_target = (deck)target; EditorGUI.BeginChangeCheck(); Undo.RecordObject(my_target, "edit_rules"); EditorGUILayout.LabelField("Deck"); //my_target.give_an_useful_card_not_less_than_n_new_card_from_the_deck = EditorGUILayout.IntField("Max number of useless card to discover before find a good card", my_target.give_an_useful_card_not_less_than_n_new_card_from_the_deck); my_target.maxUndoSteps = EditorGUILayout.IntField("Max undo steps", my_target.maxUndoSteps); EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(my_target); } EditorGUILayout.Space(); }
void Score() { deck my_target = (deck)target; EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField("Score"); EditorGUI.indentLevel++; my_target.ghostScoreFinalPos = EditorGUILayout.ObjectField("Ghost Score Final Pos", my_target.ghostScoreFinalPos, typeof(Transform), true) as Transform; my_target.normal_card_score = EditorGUILayout.IntField("Normal card", my_target.normal_card_score); my_target.expose_card_score = EditorGUILayout.IntField("Expose card", my_target.expose_card_score); my_target.undo_score = EditorGUILayout.IntField("Undo", my_target.undo_score); my_target.bonus_time = EditorGUILayout.FloatField("Bonus time (secs)", my_target.bonus_time); EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUILayout.LabelField("Combo"); EditorGUI.indentLevel++; my_target.combo_enabled = EditorGUILayout.Toggle("Combos enabled", my_target.combo_enabled); for (int i = 0; i < 7; i++) { my_target.combo_texts[i] = EditorGUILayout.TextField("Combo Text " + (i + 1).ToString(), my_target.combo_texts[i]); my_target.combo_scores[i] = EditorGUILayout.IntField("Combo Score " + (i + 1).ToString(), my_target.combo_scores[i]); my_target.combo_triggers[i] = EditorGUILayout.IntField("Combo Trigger " + (i + 1).ToString(), my_target.combo_triggers[i]); } EditorGUI.indentLevel--; if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(my_target); } EditorGUILayout.Space(); }
void Sprites() { deck my_target = (deck)target; EditorGUI.BeginChangeCheck(); Undo.RecordObject(my_target, "edit_sprite"); my_target.editor_show_sprites = EditorGUILayout.Foldout(my_target.editor_show_sprites, "Sprites"); if (my_target.editor_show_sprites) { EditorGUI.indentLevel++; my_target.editor_show_sprites_normal = EditorGUILayout.Foldout(my_target.editor_show_sprites_normal, "normal"); if (my_target.editor_show_sprites_normal) { EditorGUI.indentLevel++; if (!my_target.card_back_sprite) { GUI.color = Color.red; } else { GUI.color = Color.white; } my_target.card_back_sprite = EditorGUILayout.ObjectField("back", my_target.card_back_sprite, typeof(Sprite), false) as Sprite; GUI.color = Color.white; my_target.editor_show_sprites_normal_clubs = EditorGUILayout.Foldout(my_target.editor_show_sprites_normal_clubs, "clubs"); if (my_target.editor_show_sprites_normal_clubs) { EditorGUI.indentLevel++; for (int i = 0; i < 13; i++) { if (!my_target.clubs[i]) { GUI.color = Color.red; } else { GUI.color = Color.white; } my_target.clubs[i] = EditorGUILayout.ObjectField(Sprite_name(i), my_target.clubs[i], typeof(Sprite), false) as Sprite; GUI.color = Color.white; } EditorGUI.indentLevel--; } my_target.editor_show_sprites_normal_spades = EditorGUILayout.Foldout(my_target.editor_show_sprites_normal_spades, "spades"); if (my_target.editor_show_sprites_normal_spades) { EditorGUI.indentLevel++; for (int i = 0; i < 13; i++) { if (!my_target.spades[i]) { GUI.color = Color.red; } else { GUI.color = Color.white; } my_target.spades[i] = EditorGUILayout.ObjectField(Sprite_name(i), my_target.spades[i], typeof(Sprite), false) as Sprite; GUI.color = Color.white; } EditorGUI.indentLevel--; } my_target.editor_show_sprites_normal_diamonds = EditorGUILayout.Foldout(my_target.editor_show_sprites_normal_diamonds, "diamonds"); if (my_target.editor_show_sprites_normal_diamonds) { EditorGUI.indentLevel++; for (int i = 0; i < 13; i++) { if (!my_target.diamonds[i]) { GUI.color = Color.red; } else { GUI.color = Color.white; } my_target.diamonds[i] = EditorGUILayout.ObjectField(Sprite_name(i), my_target.diamonds[i], typeof(Sprite), false) as Sprite; GUI.color = Color.white; } EditorGUI.indentLevel--; } my_target.editor_show_sprites_normal_hearts = EditorGUILayout.Foldout(my_target.editor_show_sprites_normal_hearts, "hearts"); if (my_target.editor_show_sprites_normal_hearts) { EditorGUI.indentLevel++; for (int i = 0; i < 13; i++) { if (!my_target.hearts[i]) { GUI.color = Color.red; } else { GUI.color = Color.white; } my_target.hearts[i] = EditorGUILayout.ObjectField(Sprite_name(i), my_target.hearts[i], typeof(Sprite), false) as Sprite; GUI.color = Color.white; } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(my_target); } EditorGUILayout.Space(); }
IEnumerator RotateCard(deck drawnCard) { SetImgOnCardDisabled(true); float timer = 0; Quaternion orgRotation = cardChecker.transform.rotation; bool cardHasBeenUpdated = true; while (timer < rotateTimer) { cardChecker.transform.rotation = Quaternion.Lerp(orgRotation, Quaternion.Euler(0, 0, 0), timer / rotateTimer); if (timer / rotateTimer >= 0.5) { if (cardHasBeenUpdated) { cardImage.sprite = cardIMG.blankCard; UpdateCardGFX(drawnCard); cardHasBeenUpdated = false; } } timer += Time.deltaTime; yield return new WaitForFixedUpdate(); } }
void UpdateCardGFX(deck card) { SetImgOnCardDisabled(false); UpdateSuit(card); UpdateNumber(card); if (card.card == Card.ace || card.card == Card.jack || card.card == Card.queen || card.card == Card.king) { UpdateHighCardIMG(card); } else { if (card.card == Card.two) { SetUpImgAndPatern(2); UpdateSortImg(card); } else if (card.card == Card.three) { SetUpImgAndPatern(3); UpdateSortImg(card); } else if (card.card == Card.four) { SetUpImgAndPatern(4); UpdateSortImg(card); } else if (card.card == Card.five) { SetUpImgAndPatern(5); UpdateSortImg(card); } else if (card.card == Card.six) { SetUpImgAndPatern(6); UpdateSortImg(card); } else if (card.card == Card.seven) { SetUpImgAndPatern(7); UpdateSortImg(card); } else if (card.card == Card.eight) { SetUpImgAndPatern(8); UpdateSortImg(card); } else if (card.card == Card.nine) { SetUpImgAndPatern(9); UpdateSortImg(card); } else if (card.card == Card.ten) { SetUpImgAndPatern(10); UpdateSortImg(card); } } }
private void UpdateHighCardIMG(deck card) { if (card.card == Card.ace) { higCardImageOnCard.gameObject.SetActive(true); if (card.suit == Suit.clubs) { higCardImageOnCard.sprite = cardIMG.aceSpade; } else if (card.suit == Suit.dimond) { higCardImageOnCard.sprite = cardIMG.aceDimond; } else if (card.suit == Suit.spade) { higCardImageOnCard.sprite = cardIMG.aceSpade; } else if (card.suit == Suit.heart) { higCardImageOnCard.sprite = cardIMG.aceHeart; } } else if (card.card == Card.jack) { higCardImageOnCard.gameObject.SetActive(true); if (card.suit == Suit.clubs) { higCardImageOnCard.sprite = cardIMG.jackClubs; } else if (card.suit == Suit.dimond) { higCardImageOnCard.sprite = cardIMG.jackDimond; } else if (card.suit == Suit.spade) { higCardImageOnCard.sprite = cardIMG.jackSpade; } else if (card.suit == Suit.heart) { higCardImageOnCard.sprite = cardIMG.jackHeart; } } else if (card.card == Card.queen) { higCardImageOnCard.gameObject.SetActive(true); if (card.suit == Suit.clubs) { higCardImageOnCard.sprite = cardIMG.queenClubs; } else if (card.suit == Suit.dimond) { higCardImageOnCard.sprite = cardIMG.queenDimond; } else if (card.suit == Suit.spade) { higCardImageOnCard.sprite = cardIMG.queenSpade; } else if (card.suit == Suit.heart) { higCardImageOnCard.sprite = cardIMG.queenHeart; } } else if (card.card == Card.king) { higCardImageOnCard.gameObject.SetActive(true); if (card.suit == Suit.clubs) { higCardImageOnCard.sprite = cardIMG.kingClubs; } else if (card.suit == Suit.dimond) { higCardImageOnCard.sprite = cardIMG.kingDimond; } else if (card.suit == Suit.spade) { higCardImageOnCard.sprite = cardIMG.kingSpade; } else if (card.suit == Suit.heart) { higCardImageOnCard.sprite = cardIMG.kingHeart; } } }
private void UpdateSuit(deck card) { foreach (Image sort in sortOnCard) { sort.gameObject.SetActive(true); if (card.suit == Suit.heart) { sort.sprite = cardIMG.heart; } else if (card.suit == Suit.spade) { sort.sprite = cardIMG.spade; } else if (card.suit == Suit.dimond) { sort.sprite = cardIMG.dimond; } else if (card.suit == Suit.clubs) { sort.sprite = cardIMG.clubs; } } }
private void UpdateNumber(deck card) { foreach (Text number in numberOnCard) { number.gameObject.SetActive(true); //þarf ekki að vera kallað í hvert sinn if (card.card == Card.ace) { number.text = "A"; } else if (card.card == Card.two) { number.text = "2"; } else if (card.card == Card.three) { number.text = "3"; } else if (card.card == Card.four) { number.text = "4"; } else if (card.card == Card.five) { number.text = "5"; } else if (card.card == Card.six) { number.text = "6"; } else if (card.card == Card.seven) { number.text = "7"; } else if (card.card == Card.eight) { number.text = "8"; } else if (card.card == Card.nine) { number.text = "9"; } else if (card.card == Card.ten) { number.text = "10"; } else if (card.card == Card.jack) { number.text = "G"; } else if (card.card == Card.queen) { number.text = "Q"; } else if (card.card == Card.king) { number.text = "K"; } } }