Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent changes to anntzer/redeal #6

Merged
merged 15 commits into from
May 15, 2024
Merged
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15, windows-2019]
python-version: ["3.6", "3.10"]
include:
- {os: ubuntu-latest, python-version: "3.7"}
- {os: ubuntu-latest, python-version: "3.12"}
- {os: macos-latest, python-version: "3.9"}
- {os: macos-latest, python-version: "3.12"}
- {os: windows-latest, python-version: "3.6"}
- {os: windows-latest, python-version: "3.12"}
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graft dds
115 changes: 55 additions & 60 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ package is directly from GitHub,

$ python -mpip install --user --upgrade git+https://github.com/anntzer/redeal

On Windows **only**, you can also download the ``.zip`` archive (from master,
On Windows **only**, you can also download the ``.zip`` archive (from main,
not from the releases), and run, from the directory containing the archive,
``python -mpip install --user --upgrade redeal-master.zip`` (or whatever name
``python -mpip install --user --upgrade redeal-main.zip`` (or whatever name
it has).

Directly running ``setup.py`` is **not** supported in either case.

Now, run ``python -mredeal --help``, or ``python -mredeal`` to get a few hands,
or ``python -mredeal examples/deal1.py`` for an example simulation. In the
``examples`` directory (which you can extract from the zip archive), ``python
Expand Down Expand Up @@ -76,13 +74,12 @@ Run ``python -mredeal`` at the command line to deal 10 hands, or ``python
.. code:: sh

$ python -mredeal -n2
♠AQ53QJ9K963♣T9 ♠KAK853AQ87♣A42 ♠9767642T2♣KJ73 ♠JT842♡T♢J54♣Q865
♠T7J862QT4♣8752 ♠Q93T95A32♣KQ94 ♠K854AK7KJ87♣T3 ♠AJ62Q43965♣AJ6
♠AQ53QJ9K963♣T9 ♠KAK853AQ87♣A42 ♠9767642T2♣KJ73 ♠JT842♥T♦J54♣Q865
♠T7J862QT4♣8752 ♠Q93T95A32♣KQ94 ♠K854AK7KJ87♣T3 ♠AJ62Q43965♣AJ6
Tries: 2

Note that if your terminal does not support UTF-8 (e.g. Windows' Command
Prompt, or possibly Mac's Terminal.app), suit symbols will be replaced by
letters -- but the rest should work fine.
Note that if your terminal does not support UTF-8, suit symbols will be
replaced by letters -- but the rest should work fine.

Here, the number of tries is the same as the number of hands, as any hand is
accepted. This may not be the case in more complex cases.
Expand All @@ -93,22 +90,22 @@ can be set at the top of the window.
Stacking a hand
---------------

Would you open 2 or 3 with ♠-KQJT62T9876♣84? Well, let's deal a couple of
Would you open 2 or 3 with ♠-KQJT62T9876♣84? Well, let's deal a couple of
hands to see how this would fare.

.. code:: sh

$ python -mredeal -S '- KQJT62 T9876 84'
♠AT982854J42♣KT ♠KQ7A973AK5♣AQJ ♠KQJT62T9876♣84 ♠J6543♡♢Q3♣976532
♠85854K4♣JT9752 ♠K97643A97A♣KQ6 ♠KQJT62T9876♣84 ♠AQJT2♡3♢QJ532♣A3
♠94♡97♢KJ42♣QJ972 ♠KJ852A85AQ3♣K5 ♠KQJT62T9876♣84 ♠AQT763♡43♢5♣AT63
♠KJT963A954K4♣2 ♠AQ82♡7♢5♣AKJT753 ♠KQJT62T9876♣84 ♠754♡83♢AQJ32♣Q96
♠984♡93♢AJ543♣AK7 ♠AJ52A84KQ♣JT96 ♠KQJT62T9876♣84 ♠KQT763♡75♢2♣Q532
♠J974♡53♢QJ43♣T62 ♠AKQ852A97♣J975 ♠KQJT62T9876♣84 ♠T63♡84♢AK52♣AKQ3
♠742♡73♢AQ♣AK9763 ♠KJTA95J542♣J52 ♠KQJT62T9876♣84 ♠AQ98653♡84♢K3♣QT
♠Q82♡A9♢A42♣AT732 ♠AJ754♡85♢KJ5♣Q95 ♠KQJT62T9876♣84 ♠KT963743Q3♣KJ6
♠QJT543♡8♢AJ3♣Q53 ♠K876A9743K5♣JT ♠KQJT62T9876♣84 ♠A92♡5♢Q42♣AK9762
♠AQJ8432♡4♢AQ♣KT5 ♠KT96A9832♣AJ76 ♠KQJT62T9876♣84 ♠75753KJ54♣Q932
♠AT982854J42♣KT ♠KQ7A973AK5♣AQJ ♠KQJT62T9876♣84 ♠J6543♥♦Q3♣976532
♠85854K4♣JT9752 ♠K97643A97A♣KQ6 ♠KQJT62T9876♣84 ♠AQJT2♥3♦QJ532♣A3
♠94♥97♦KJ42♣QJ972 ♠KJ852A85AQ3♣K5 ♠KQJT62T9876♣84 ♠AQT763♥43♦5♣AT63
♠KJT963A954K4♣2 ♠AQ82♥7♦5♣AKJT753 ♠KQJT62T9876♣84 ♠754♥83♦AQJ32♣Q96
♠984♥93♦AJ543♣AK7 ♠AJ52A84KQ♣JT96 ♠KQJT62T9876♣84 ♠KQT763♥75♦2♣Q532
♠J974♥53♦QJ43♣T62 ♠AKQ852A97♣J975 ♠KQJT62T9876♣84 ♠T63♥84♦AK52♣AKQ3
♠742♥73♦AQ♣AK9763 ♠KJTA95J542♣J52 ♠KQJT62T9876♣84 ♠AQ98653♥84♦K3♣QT
♠Q82♥A9♦A42♣AT732 ♠AJ754♥85♦KJ5♣Q95 ♠KQJT62T9876♣84 ♠KT963743Q3♣KJ6
♠QJT543♥8♦AJ3♣Q53 ♠K876A9743K5♣JT ♠KQJT62T9876♣84 ♠A92♥5♦Q42♣AK9762
♠AQJ8432♥4♦AQ♣KT5 ♠KT96A9832♣AJ76 ♠KQJT62T9876♣84 ♠75753KJ54♣Q932
Tries: 10

There are also ``-N``, ``-E`` and ``-W`` options, with the expected meanings.
Expand All @@ -131,18 +128,18 @@ option) is there for that!
$ python -mredeal --format=long -n1

632
AKT92
632
AKT92
♣K7652

♠AJ85 ♠T962
KJ954 7
QJ 8763
KJ954 7
QJ 8763
♣QJ ♣AT94

♠KQ743
AQT8
54
AQT8
54
♣83

Tries: 1
Expand All @@ -168,16 +165,16 @@ and run it as follows:
.. code:: sh

$ python -mredeal examples/onespade.py # put the path to onespade.py
♠AJ854J986T♣AKJ ♠KQ96♡2♢KJ874♣T52 ♠T732AKQT43Q2♣3 ♠♡75♢A9653♣Q98764
♠AQ875T87A♣QJ84 ♠T943♡♢9752♣T9652 ♠J6AQJ9432J6♣A7 ♠K2K65KQT843♣K3
♠KQ9874♡J4♢J43♣KQ ♠J65A8732♣AJT87 ♠A2K65AT975♣652 ♠T3QT92KQ86♣943
♠QT6543♡A9♢KT♣K32 ♠72KT74A9♣QT754 ♠J98QJ865QJ8♣J8 ♠AK♡32♢765432♣A96
♠AT862KQJQ65♣K2 ♠QJ953A8327♣A53 ♠4T765KT983♣Q87 ♠K7♡94♢AJ42♣JT964
♠KQ974A6529♣QJ3 ♠AJ5♡Q7♢KQ8♣A9872 ♠K84AT76543♣T64 ♠T8632JT93J2♣K5
♠AJ943♡Q♢AQJT♣JT9 ♠T52AJTK852♣AQ6 ♠KQ6K87653297♣2 ♠87♡94♢643♣K87543
♠KQT532♡KQ♢K♣KQ92 ♠8♡T5♢A864♣AT7654 ♠AJ7698643Q5♣83 ♠94AJ72JT9732♣J
♠AT9743♡Q7♢J♣AKT2 ♠8A932AKT7♣J963 ♠K62♡J5♢98653♣874 ♠QJ5KT864Q42♣Q5
♠KJ842♡K5♢94♣AK74 ♠53♡Q7♢762♣Q98653 ♠AQ96943JT85♣JT ♠T7AJT862AKQ3♣2
♠AJ854J986T♣AKJ ♠KQ96♥2♦KJ874♣T52 ♠T732AKQT43Q2♣3 ♠♥75♦A9653♣Q98764
♠AQ875T87A♣QJ84 ♠T943♥♦9752♣T9652 ♠J6AQJ9432J6♣A7 ♠K2K65KQT843♣K3
♠KQ9874♥J4♦J43♣KQ ♠J65A8732♣AJT87 ♠A2K65AT975♣652 ♠T3QT92KQ86♣943
♠QT6543♥A9♦KT♣K32 ♠72KT74A9♣QT754 ♠J98QJ865QJ8♣J8 ♠AK♥32♦765432♣A96
♠AT862KQJQ65♣K2 ♠QJ953A8327♣A53 ♠4T765KT983♣Q87 ♠K7♥94♦AJ42♣JT964
♠KQ974A6529♣QJ3 ♠AJ5♥Q7♦KQ8♣A9872 ♠K84AT76543♣T64 ♠T8632JT93J2♣K5
♠AJ943♥Q♦AQJT♣JT9 ♠T52AJTK852♣AQ6 ♠KQ6K87653297♣2 ♠87♥94♦643♣K87543
♠KQT532♥KQ♦K♣KQ92 ♠8♥T5♦A864♣AT7654 ♠AJ7698643Q5♣83 ♠94AJ72JT9732♣J
♠AT9743♥Q7♦J♣AKT2 ♠8A932AKT7♣J963 ♠K62♥J5♦98653♣874 ♠QJ5KT864Q42♣Q5
♠KJ842♥K5♦94♣AK74 ♠53♥Q7♦762♣Q98653 ♠AQ96943JT85♣JT ♠T7AJT862AKQ3♣2
Tries: 120

The ``accept`` function is called after each deal is dealt. It can either
Expand Down Expand Up @@ -209,38 +206,38 @@ One can also give the ``accept`` function, as the body of a function taking a
.. code:: sh

$ python -mredeal --accept 'return len(deal.north.spades) >= 5 and deal.north.hcp >= 12'
♠AKJT7♡85♢865♣KQ7 ♠852A74AQT42♣86 ♠963KJ3J973♣AT4 ♠Q4QT962K♣J9532
♠AKT86AJ7664♣42 ♠J954♡T♢KT752♣KT5 ♠3KQ853A983♣Q76 ♠Q72942QJ♣AJ983
♠AQ753A96A♣AT43 ♠KJT6KQ83Q753♣8 ♠9JT75KT42♣KQJ7 ♠842♡42♢J986♣9652
♠A98543♡63♢KQ♣AQ9 ♠J2AJT2J976♣J63 ♠QT6K9874T43♣K8 ♠K7♡Q5♢A852♣T7542
♠AK9642♡JT♢J9♣A42 ♠75A732AKQ84♣Q3 ♠T3K54T653♣KJT6 ♠QJ8Q98672♣9875
♠AK832♡3♢32♣AKQT2 ♠964♡J6♢AKJ5♣8765 ♠J7AK85426♣J943 ♠QT5QT97QT9874♣
♠AQ432♡♢KJT43♣Q74 ♠J9859765A862♣T ♠6AKQJ82Q7♣AJ32 ♠KT7T4395♣K9865
♠AJT83AJ882♣Q75 ♠Q64Q975J76♣KJ2 ♠75KT4KT93♣T943 ♠K92632AQ54♣A86
♠AJ652♡J2♢A9♣Q953 ♠KQ93AKT6KQ2♣84 ♠T87874873♣AT72 ♠4Q953JT654♣KJ6
♠KQJT9♡98♢KT♣K962 ♠J65432763♣AJ83 ♠A8652AQ7A8♣T54 ♠743♡KT♢QJ9542♣Q7
♠AKJT7♥85♦865♣KQ7 ♠852A74AQT42♣86 ♠963KJ3J973♣AT4 ♠Q4QT962K♣J9532
♠AKT86AJ7664♣42 ♠J954♥T♦KT752♣KT5 ♠3KQ853A983♣Q76 ♠Q72942QJ♣AJ983
♠AQ753A96A♣AT43 ♠KJT6KQ83Q753♣8 ♠9JT75KT42♣KQJ7 ♠842♥42♦J986♣9652
♠A98543♥63♦KQ♣AQ9 ♠J2AJT2J976♣J63 ♠QT6K9874T43♣K8 ♠K7♥Q5♦A852♣T7542
♠AK9642♥JT♦J9♣A42 ♠75A732AKQ84♣Q3 ♠T3K54T653♣KJT6 ♠QJ8Q98672♣9875
♠AK832♥3♦32♣AKQT2 ♠964♥J6♦AKJ5♣8765 ♠J7AK85426♣J943 ♠QT5QT97QT9874♣
♠AQ432♥♦KJT43♣Q74 ♠J9859765A862♣T ♠6AKQJ82Q7♣AJ32 ♠KT7T4395♣K9865
♠AJT83AJ882♣Q75 ♠Q64Q975J76♣KJ2 ♠75KT4KT93♣T943 ♠K92632AQ54♣A86
♠AJ652♥J2♦A9♣Q953 ♠KQ93AKT6KQ2♣84 ♠T87874873♣AT72 ♠4Q953JT654♣KJ6
♠KQJT9♥98♦KT♣K962 ♠J65432763♣AJ83 ♠A8652AQ7A8♣T54 ♠743♥KT♦QJ9542♣Q7
Tries: 203


Predealing and scripting
------------------------

Your partner opens 1♠ and you hold ♠-96532A864♣T962... do you pass or bid
Your partner opens 1♠ and you hold ♠-96532A864♣T962... do you pass or bid
a forcing NT? Let's generate a few hands so that we can see how we would fare.

.. code:: sh

$ python -mredeal -S '- 96532 A864 T962' examples/onespade.py
♠A8643♡A8♢QT72♣Q8 ♠QT972♡Q♢K95♣K754 ♠96532A864♣T962 ♠KJ5KJT74J3♣AJ3
♠AQ864♡4♢KJT72♣QJ ♠JT7AJT8Q3♣A743 ♠96532A864♣T962 ♠K9532KQ795♣K85
♠AQT765♡7♢J72♣KQ8 ♠K9832AKTK953♣5 ♠96532A864♣T962 ♠J4QJ84QT♣AJ743
♠AJ932♡74♢KQJ7♣KJ ♠KQT65AK8532♣A4 ♠96532A864♣T962 ♠874QJTT9♣Q8753
♠KJ986AJT8K♣K75 ♠AT73Q74Q732♣Q8 ♠96532A864♣T962 ♠Q542♡K♢JT95♣AJ43
♠QJ9732♡A♢QJ♣AQ87 ♠T865J87K97♣J54 ♠96532A864♣T962 ♠AK4KQT4T532♣K3
♠AKQJT732♡K8♢7♣85 ♠4AJ74K53♣AKQJ4 ♠96532A864♣T962 ♠9865♡QT♢QJT92♣73
♠AK653Q84QT5♣J3 ♠982♡AT♢KJ97♣AKQ5 ♠96532A864♣T962 ♠QJT74KJ732♣874
♠AKJ98752♡7♢J5♣A3 ♠Q643AQJ4Q3♣K85 ♠96532A864♣T962 ♠TKT8KT972♣QJ74
♠KJ9863♡♢Q9♣AKJ73 ♠AT75QT87472♣85 ♠96532A864♣T962 ♠Q42AKJKJT53♣Q4
♠A8643♥A8♦QT72♣Q8 ♠QT972♥Q♦K95♣K754 ♠96532A864♣T962 ♠KJ5KJT74J3♣AJ3
♠AQ864♥4♦KJT72♣QJ ♠JT7AJT8Q3♣A743 ♠96532A864♣T962 ♠K9532KQ795♣K85
♠AQT765♥7♦J72♣KQ8 ♠K9832AKTK953♣5 ♠96532A864♣T962 ♠J4QJ84QT♣AJ743
♠AJ932♥74♦KQJ7♣KJ ♠KQT65AK8532♣A4 ♠96532A864♣T962 ♠874QJTT9♣Q8753
♠KJ986AJT8K♣K75 ♠AT73Q74Q732♣Q8 ♠96532A864♣T962 ♠Q542♥K♦JT95♣AJ43
♠QJ9732♥A♦QJ♣AQ87 ♠T865J87K97♣J54 ♠96532A864♣T962 ♠AK4KQT4T532♣K3
♠AKQJT732♥K8♦7♣85 ♠4AJ74K53♣AKQJ4 ♠96532A864♣T962 ♠9865♥QT♦QJT92♣73
♠AK653Q84QT5♣J3 ♠982♥AT♦KJ97♣AKQ5 ♠96532A864♣T962 ♠QJT74KJ732♣874
♠AKJ98752♥7♦J5♣A3 ♠Q643AQJ4Q3♣K85 ♠96532A864♣T962 ♠TKT8KT972♣QJ74
♠KJ9863♥♦Q9♣AKJ73 ♠AT75QT87472♣85 ♠96532A864♣T962 ♠Q42AKJKJT53♣Q4
Tries: 31

Again, one can also give the ``accept`` function at the command line.
Expand Down Expand Up @@ -382,12 +379,10 @@ You may also use predealing and SmartStacking, as an argument to
External links
==============

Some articles and videos produced by users showcasing the use of Redeal:
Content produced by users showcasing the use of Redeal:

- `A Simulation Tutorial for Better Decisionmaking at Bridge.`__
- `Using data science in bridge: how important is shape for 3NT and 4S?`__

__ http://datadaydreams.com/posts/a-simulation-tutorial-for-better-decisionmaking-at-bridge/
__ https://www.youtube.com/watch?v=4J6yvoxx_Fg

.. vim: set fileencoding=utf-8:
2 changes: 1 addition & 1 deletion THANKS.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Donal Lyons (LyonsDo): Windows 64-bit DLL.
Donal Lyons (LyonsDo): Windows 64-bit DLL (no longer used).
Filip Jelic (flipio): MacOS build instructions.
Jon Higa (jonhiga): bug fix.
Loading
Loading