Skip to content

Commit

Permalink
raid/mission decks: support shuffle forts
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuchka committed Feb 18, 2017
1 parent 4fc17ff commit 4ffe009
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion SimpleTUOptimizeStarter.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Gui, Add, Edit, vSimOptions r1 xs w600, %IniSimOptions%
Gui, Add, Button, default r2 w100 x100 y+15 section, Simulate
Gui, Add, Checkbox, vx86 Checked%Inix86%, x86 (32-bit)
Gui, Add, Button, r2 w100 ys xs+200, Exit
Gui, Show,, Simple Tyrant Unleashed Optimize Starter v2.47.0
Gui, Show,, Simple Tyrant Unleashed Optimize Starter v2.47.1
return

ButtonSimulate:
Expand Down
19 changes: 12 additions & 7 deletions deck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,17 +630,22 @@ void Deck::shuffle(std::mt19937& re)
}
if (strategy != DeckStrategy::exact_ordered)
{
auto shufflable_iter = shuffled_cards.begin();
for (auto hand_card_id: given_hand)
std::deque<const Card*>* pools[] = { &shuffled_forts, &shuffled_cards };
for (std::deque<const Card*>* pool : pools)
{
auto it = std::find_if (shufflable_iter, shuffled_cards.end(), [hand_card_id](const Card* card) -> bool { return card->m_id == hand_card_id; });
if (it != shuffled_cards.end())
auto shufflable_iter = pool->begin();
for (auto hand_card_id: given_hand)
{
std::swap(*shufflable_iter, *it);
++ shufflable_iter;
auto it = std::find_if (shufflable_iter, pool->end(),
[hand_card_id](const Card* card) -> bool { return card->m_id == hand_card_id; });
if (it != pool->end())
{
std::swap(*shufflable_iter, *it);
++ shufflable_iter;
}
}
std::shuffle(shufflable_iter, pool->end(), re);
}
std::shuffle(shufflable_iter, shuffled_cards.end(), re);
#if 0
if (!given_hand.empty())
{
Expand Down
2 changes: 1 addition & 1 deletion tyrant.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TYRANT_H_INCLUDED
#define TYRANT_H_INCLUDED

#define TYRANT_OPTIMIZER_VERSION "2.47.0"
#define TYRANT_OPTIMIZER_VERSION "2.47.1"

#include <string>
#include <sstream>
Expand Down

0 comments on commit 4ffe009

Please sign in to comment.