Win logic revamp + small ui change

remove stick and bust
win logic now in a function and a lot less complex
This commit is contained in:
2024-04-11 20:57:18 +02:00
parent 4263a35b18
commit ef9bcabd32
4 changed files with 506 additions and 257 deletions

View File

@@ -23,6 +23,111 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2" colspan="2">
<widget class="QLabel" name="tableLabel">
<property name="baseSize">
<size>
<width>800</width>
<height>500</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="playagainButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Play Again</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="twistButton">
<property name="text">
<string>Twist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="stickButton">
<property name="text">
<string>Stick</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@@ -156,8 +261,8 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</property>
</spacer>
</item>
<item row="8" column="3">
<spacer name="verticalSpacer_2">
<item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -172,26 +277,10 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</property>
</spacer>
</item>
<item row="12" column="3">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="3">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item row="1" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="statusLabel">
<widget class="QLabel" name="playertotalLabel">
<property name="palette">
<palette>
<active>
@@ -230,12 +319,12 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</palette>
</property>
<property name="text">
<string/>
<string>Total: 0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -248,7 +337,7 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</spacer>
</item>
<item>
<widget class="QLabel" name="outcomeLabel">
<widget class="QLabel" name="computerScoreLabel">
<property name="palette">
<palette>
<active>
@@ -287,64 +376,7 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</palette>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="computerStatusLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string/>
<string>Computer: 0</string>
</property>
</widget>
</item>
@@ -657,8 +689,8 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</item>
</layout>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer_4">
<item row="12" column="3">
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -673,10 +705,23 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</property>
</spacer>
</item>
<item row="1" column="1" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item row="9" column="3">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="playertotalLabel">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="outcomeLabel">
<property name="palette">
<palette>
<active>
@@ -715,12 +760,12 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</palette>
</property>
<property name="text">
<string>Total: 0</string>
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -732,139 +777,6 @@ border-image:url(:/images/blackjack_table.png) 0 0 0 0 stretch stretch;
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="computerScoreLabel">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="text">
<string>Computer: 0</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="2" colspan="2">
<widget class="QLabel" name="tableLabel">
<property name="baseSize">
<size>
<width>800</width>
<height>500</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="11" column="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="playagainButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Play Again</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="twistButton">
<property name="text">
<string>Twist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="stickButton">
<property name="text">
<string>Stick</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>