Commit 88f1ccf7 by Julio Hermosa

se entrega la tarea 3 (poker2)

parent 11e01ed6
File added
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="ipad9_7" orientation="portrait" layout="fullscreen" appearance="light"/> <device id="retina4_0" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
...@@ -12,26 +12,26 @@ ...@@ -12,26 +12,26 @@
<objects> <objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="poker" customModuleProvider="target" sceneMemberID="viewController"> <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="poker" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/> <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Póker" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7qK-tZ-pZY"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Póker" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7qK-tZ-pZY">
<rect key="frame" x="336" y="30" width="96.5" height="48"/> <rect key="frame" x="112" y="15" width="96.5" height="48"/>
<fontDescription key="fontDescription" type="system" pointSize="40"/> <fontDescription key="fontDescription" type="system" pointSize="40"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yDe-2w-b0i"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Jugador1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yDe-2w-b0i">
<rect key="frame" x="10" y="158" width="748" height="25"/> <rect key="frame" x="10" y="73" width="300" height="20"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="25" id="SMB-7u-Hkb"/> <constraint firstAttribute="height" constant="20" id="SMB-7u-Hkb"/>
</constraints> </constraints>
<fontDescription key="fontDescription" type="system" pointSize="22"/> <fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IRK-zS-xeX"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IRK-zS-xeX">
<rect key="frame" x="359" y="441" width="50" height="36"/> <rect key="frame" x="135" y="512" width="50" height="36"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/> <fontDescription key="fontDescription" type="system" pointSize="20"/>
<state key="normal" title="Jugar"/> <state key="normal" title="Jugar"/>
<connections> <connections>
...@@ -39,22 +39,22 @@ ...@@ -39,22 +39,22 @@
</connections> </connections>
</button> </button>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="Ou2-8o-ek7"> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="Ou2-8o-ek7">
<rect key="frame" x="246.5" y="229" width="275" height="89"/> <rect key="frame" x="22.5" y="103" width="275" height="80"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vkv-vk-1hC"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vkv-vk-1hC">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="foD-Bh-5PJ"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="foD-Bh-5PJ">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wZD-mq-pB7"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wZD-mq-pB7">
<rect key="frame" x="0.0" y="0.0" width="59" height="39"/> <rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6Zc-Lc-MZl"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6Zc-Lc-MZl">
<rect key="frame" x="0.0" y="39" width="59" height="50"/> <rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="50" id="IMr-kT-3qA"/> <constraint firstAttribute="height" constant="50" id="IMr-kT-3qA"/>
</constraints> </constraints>
...@@ -72,19 +72,19 @@ ...@@ -72,19 +72,19 @@
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kJ6-RS-iMI"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kJ6-RS-iMI">
<rect key="frame" x="108" y="0.0" width="59" height="89"/> <rect key="frame" x="108" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="m7c-vW-wz7"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="m7c-vW-wz7">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="co2-G2-mvw"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="co2-G2-mvw">
<rect key="frame" x="0.0" y="0.0" width="59" height="39"/> <rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hkh-8y-SGC"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hkh-8y-SGC">
<rect key="frame" x="0.0" y="39" width="59" height="50"/> <rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="50" id="RDs-Sn-oFI"/> <constraint firstAttribute="height" constant="50" id="RDs-Sn-oFI"/>
</constraints> </constraints>
...@@ -102,19 +102,19 @@ ...@@ -102,19 +102,19 @@
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OPs-B3-1Ef"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OPs-B3-1Ef">
<rect key="frame" x="216" y="0.0" width="59" height="89"/> <rect key="frame" x="216" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Ctf-ty-Hgs"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Ctf-ty-Hgs">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nET-I0-wui"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nET-I0-wui">
<rect key="frame" x="0.0" y="0.0" width="59" height="39"/> <rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AMf-Da-lPQ"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AMf-Da-lPQ">
<rect key="frame" x="0.0" y="39" width="59" height="50"/> <rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="50" id="xyh-Ub-SuE"/> <constraint firstAttribute="height" constant="50" id="xyh-Ub-SuE"/>
</constraints> </constraints>
...@@ -138,22 +138,22 @@ ...@@ -138,22 +138,22 @@
</constraints> </constraints>
</stackView> </stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="PeU-dx-cSX"> <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="PeU-dx-cSX">
<rect key="frame" x="300.5" y="342" width="167" height="89"/> <rect key="frame" x="76.5" y="193" width="167" height="80"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nSa-K5-FZr"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nSa-K5-FZr">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="POb-I3-v1g"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="POb-I3-v1g">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uhk-kA-oHv"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uhk-kA-oHv">
<rect key="frame" x="0.0" y="0.0" width="59" height="39"/> <rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4cB-Yi-Rqp"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4cB-Yi-Rqp">
<rect key="frame" x="0.0" y="39" width="59" height="50"/> <rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="50" id="7qQ-YJ-8lt"/> <constraint firstAttribute="height" constant="50" id="7qQ-YJ-8lt"/>
</constraints> </constraints>
...@@ -171,19 +171,19 @@ ...@@ -171,19 +171,19 @@
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pJN-TX-u7x"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pJN-TX-u7x">
<rect key="frame" x="108" y="0.0" width="59" height="89"/> <rect key="frame" x="108" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ktJ-ct-jmf"> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ktJ-ct-jmf">
<rect key="frame" x="0.0" y="0.0" width="59" height="89"/> <rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta5" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0hO-2H-sNS"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta5" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0hO-2H-sNS">
<rect key="frame" x="0.0" y="0.0" width="59" height="39"/> <rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/> <nil key="textColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SsM-4A-1du"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="SsM-4A-1du">
<rect key="frame" x="0.0" y="39" width="59" height="50"/> <rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="50" id="d5C-gb-Qf6"/> <constraint firstAttribute="height" constant="50" id="d5C-gb-Qf6"/>
</constraints> </constraints>
...@@ -203,46 +203,242 @@ ...@@ -203,46 +203,242 @@
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="pJN-TX-u7x" firstAttribute="leading" secondItem="PeU-dx-cSX" secondAttribute="leading" constant="108" id="fo8-T7-DpP"/> <constraint firstItem="pJN-TX-u7x" firstAttribute="leading" secondItem="PeU-dx-cSX" secondAttribute="leading" constant="108" id="fo8-T7-DpP"/>
<constraint firstAttribute="height" constant="89" id="kgk-hx-0zp"/> <constraint firstAttribute="height" constant="80" id="kgk-hx-0zp"/>
</constraints> </constraints>
</stackView> </stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="2jU-Q7-DQV">
<rect key="frame" x="22.5" y="308" width="275" height="80"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hWA-wr-RVd">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ZLa-Tc-PE3">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta1" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yLL-Ou-463">
<rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="prS-u5-cA1">
<rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="VVC-P1-8y0"/>
</constraints>
</imageView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="ZLa-Tc-PE3" secondAttribute="trailing" id="2qZ-6V-3cR"/>
<constraint firstAttribute="bottom" secondItem="ZLa-Tc-PE3" secondAttribute="bottom" id="AT7-M8-Ap6"/>
<constraint firstItem="ZLa-Tc-PE3" firstAttribute="top" secondItem="hWA-wr-RVd" secondAttribute="top" id="dAO-C8-X1D"/>
<constraint firstItem="ZLa-Tc-PE3" firstAttribute="leading" secondItem="hWA-wr-RVd" secondAttribute="leading" id="eMN-Oi-t1y"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5YQ-vM-Uvc">
<rect key="frame" x="108" y="0.0" width="59" height="80"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="N5J-cR-GaV">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta2" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2rw-Ry-jTo">
<rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cy2-gD-X1V">
<rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="wZb-5d-C3O"/>
</constraints>
</imageView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="N5J-cR-GaV" secondAttribute="trailing" id="BOS-az-RkN"/>
<constraint firstAttribute="bottom" secondItem="N5J-cR-GaV" secondAttribute="bottom" id="KRT-r7-AY1"/>
<constraint firstItem="N5J-cR-GaV" firstAttribute="leading" secondItem="5YQ-vM-Uvc" secondAttribute="leading" id="PLJ-0C-obj"/>
<constraint firstItem="N5J-cR-GaV" firstAttribute="top" secondItem="5YQ-vM-Uvc" secondAttribute="top" id="aeF-q5-hD2"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vZe-Cp-6Bx">
<rect key="frame" x="216" y="0.0" width="59" height="80"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="U5W-zu-hFg">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3xy-FU-6r3">
<rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kHB-vu-dph">
<rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="wLF-jA-fOO"/>
</constraints>
</imageView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="U5W-zu-hFg" secondAttribute="trailing" id="8Mq-kd-SuM"/>
<constraint firstAttribute="bottom" secondItem="U5W-zu-hFg" secondAttribute="bottom" id="AoC-Xo-h0f"/>
<constraint firstItem="U5W-zu-hFg" firstAttribute="top" secondItem="vZe-Cp-6Bx" secondAttribute="top" id="CvV-c9-T2Y"/>
<constraint firstItem="U5W-zu-hFg" firstAttribute="leading" secondItem="vZe-Cp-6Bx" secondAttribute="leading" id="xRM-5N-IzS"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="5YQ-vM-Uvc" firstAttribute="leading" secondItem="2jU-Q7-DQV" secondAttribute="leading" constant="108" id="Wj1-yE-0sD"/>
<constraint firstItem="5YQ-vM-Uvc" firstAttribute="centerX" secondItem="2jU-Q7-DQV" secondAttribute="centerX" id="aE2-ZH-Ne1"/>
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="49" translatesAutoresizingMaskIntoConstraints="NO" id="adp-bO-yd2">
<rect key="frame" x="76.5" y="398" width="167" height="80"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="iqk-xW-mRy">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="k35-fQ-abq">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OnF-cb-pRq">
<rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mkR-Ub-itz">
<rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="KV2-Ma-mVo"/>
</constraints>
</imageView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="k35-fQ-abq" secondAttribute="trailing" id="1xH-yp-2ih"/>
<constraint firstAttribute="bottom" secondItem="k35-fQ-abq" secondAttribute="bottom" id="H1g-1x-6y0"/>
<constraint firstItem="k35-fQ-abq" firstAttribute="top" secondItem="iqk-xW-mRy" secondAttribute="top" id="bNC-qH-4Oa"/>
<constraint firstItem="k35-fQ-abq" firstAttribute="leading" secondItem="iqk-xW-mRy" secondAttribute="leading" id="rgF-l6-k33"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="grc-h7-OAR">
<rect key="frame" x="108" y="0.0" width="59" height="80"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="1BS-MF-JOb">
<rect key="frame" x="0.0" y="0.0" width="59" height="80"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Carta5" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d0Y-fC-k9E">
<rect key="frame" x="0.0" y="0.0" width="59" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="BTH-nV-LEb">
<rect key="frame" x="0.0" y="30" width="59" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="A9x-Nt-PpV"/>
</constraints>
</imageView>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" cocoaTouchSystemColor="darkTextColor"/>
<constraints>
<constraint firstItem="1BS-MF-JOb" firstAttribute="leading" secondItem="grc-h7-OAR" secondAttribute="leading" id="9kx-kp-oVb"/>
<constraint firstAttribute="trailing" secondItem="1BS-MF-JOb" secondAttribute="trailing" id="NWF-3u-6Rd"/>
<constraint firstItem="1BS-MF-JOb" firstAttribute="top" secondItem="grc-h7-OAR" secondAttribute="top" id="Wsy-dH-ejc"/>
<constraint firstAttribute="bottom" secondItem="1BS-MF-JOb" secondAttribute="bottom" id="waF-SH-iVU"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="80" id="210-Rt-l29"/>
<constraint firstItem="grc-h7-OAR" firstAttribute="leading" secondItem="adp-bO-yd2" secondAttribute="leading" constant="108" id="sdg-hg-ucL"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Jugador2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kLZ-vz-YQG">
<rect key="frame" x="10" y="281" width="69.5" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="c5j-JK-kgc"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints> <constraints>
<constraint firstItem="kLZ-vz-YQG" firstAttribute="top" secondItem="PeU-dx-cSX" secondAttribute="bottom" constant="8" id="1BB-Q7-vVf"/>
<constraint firstItem="PeU-dx-cSX" firstAttribute="height" secondItem="Ou2-8o-ek7" secondAttribute="height" id="1bh-Cb-fxu"/> <constraint firstItem="PeU-dx-cSX" firstAttribute="height" secondItem="Ou2-8o-ek7" secondAttribute="height" id="1bh-Cb-fxu"/>
<constraint firstItem="yDe-2w-b0i" firstAttribute="top" secondItem="7qK-tZ-pZY" secondAttribute="bottom" constant="80" id="2Ve-gJ-Zdf"/> <constraint firstItem="yDe-2w-b0i" firstAttribute="top" secondItem="7qK-tZ-pZY" secondAttribute="bottom" constant="10" id="2Ve-gJ-Zdf"/>
<constraint firstItem="7qK-tZ-pZY" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="30" id="3G6-IF-sqT"/> <constraint firstItem="7qK-tZ-pZY" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="15" id="3G6-IF-sqT"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="yDe-2w-b0i" secondAttribute="trailing" constant="10" id="9jO-44-FVE"/> <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="yDe-2w-b0i" secondAttribute="trailing" constant="10" id="9jO-44-FVE"/>
<constraint firstItem="IRK-zS-xeX" firstAttribute="top" secondItem="PeU-dx-cSX" secondAttribute="bottom" constant="10" id="APb-tF-GQe"/> <constraint firstItem="IRK-zS-xeX" firstAttribute="top" secondItem="adp-bO-yd2" secondAttribute="bottom" constant="34" id="AwW-oL-den"/>
<constraint firstItem="2jU-Q7-DQV" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="BI8-5m-x9h"/>
<constraint firstItem="yDe-2w-b0i" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="10" id="Bhc-NG-hIk"/> <constraint firstItem="yDe-2w-b0i" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="10" id="Bhc-NG-hIk"/>
<constraint firstItem="adp-bO-yd2" firstAttribute="height" secondItem="2jU-Q7-DQV" secondAttribute="height" id="Cjm-Xu-Xly"/>
<constraint firstItem="PeU-dx-cSX" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="N1k-Qw-I4H"/> <constraint firstItem="PeU-dx-cSX" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="N1k-Qw-I4H"/>
<constraint firstItem="PeU-dx-cSX" firstAttribute="top" secondItem="Ou2-8o-ek7" secondAttribute="bottom" constant="24" id="dyZ-7b-HYP"/> <constraint firstItem="kLZ-vz-YQG" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="10" id="PIA-vo-qvs"/>
<constraint firstItem="Ou2-8o-ek7" firstAttribute="top" secondItem="yDe-2w-b0i" secondAttribute="bottom" constant="46" id="hxs-tN-4VS"/> <constraint firstItem="PeU-dx-cSX" firstAttribute="top" secondItem="Ou2-8o-ek7" secondAttribute="bottom" constant="10" id="dyZ-7b-HYP"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="kLZ-vz-YQG" secondAttribute="trailing" symbolic="YES" id="gIO-IL-irB"/>
<constraint firstItem="Ou2-8o-ek7" firstAttribute="top" secondItem="yDe-2w-b0i" secondAttribute="bottom" constant="10" id="hxs-tN-4VS"/>
<constraint firstItem="IRK-zS-xeX" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="iVj-y0-HEC"/> <constraint firstItem="IRK-zS-xeX" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="iVj-y0-HEC"/>
<constraint firstItem="7qK-tZ-pZY" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="kGX-cd-HyQ"/> <constraint firstItem="7qK-tZ-pZY" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="kGX-cd-HyQ"/>
<constraint firstItem="yDe-2w-b0i" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="khX-9w-MHA"/> <constraint firstItem="yDe-2w-b0i" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="khX-9w-MHA"/>
<constraint firstItem="adp-bO-yd2" firstAttribute="top" secondItem="2jU-Q7-DQV" secondAttribute="bottom" constant="10" id="vnZ-E3-Jai"/>
<constraint firstItem="2jU-Q7-DQV" firstAttribute="top" secondItem="kLZ-vz-YQG" secondAttribute="bottom" constant="7" id="vvp-48-Tia"/>
<constraint firstItem="Ou2-8o-ek7" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="w3j-8l-uEg"/> <constraint firstItem="Ou2-8o-ek7" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="w3j-8l-uEg"/>
<constraint firstItem="adp-bO-yd2" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="y0a-N9-xvj"/>
</constraints> </constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view> </view>
<connections> <connections>
<outlet property="imagenCarta1" destination="6Zc-Lc-MZl" id="fc8-GN-wOW"/> <outlet property="imagenCarta1" destination="6Zc-Lc-MZl" id="fc8-GN-wOW"/>
<outlet property="imagenCarta10" destination="BTH-nV-LEb" id="V54-J9-B9h"/>
<outlet property="imagenCarta2" destination="hkh-8y-SGC" id="ffl-XY-jC1"/> <outlet property="imagenCarta2" destination="hkh-8y-SGC" id="ffl-XY-jC1"/>
<outlet property="imagenCarta3" destination="AMf-Da-lPQ" id="8iM-0g-Vzh"/> <outlet property="imagenCarta3" destination="AMf-Da-lPQ" id="8iM-0g-Vzh"/>
<outlet property="imagenCarta4" destination="4cB-Yi-Rqp" id="IJo-fV-q8G"/> <outlet property="imagenCarta4" destination="4cB-Yi-Rqp" id="IJo-fV-q8G"/>
<outlet property="imagenCarta5" destination="SsM-4A-1du" id="c07-ZH-y9K"/> <outlet property="imagenCarta5" destination="SsM-4A-1du" id="c07-ZH-y9K"/>
<outlet property="imagenCarta6" destination="prS-u5-cA1" id="Za2-dn-f9o"/>
<outlet property="imagenCarta7" destination="cy2-gD-X1V" id="eZL-D0-fTq"/>
<outlet property="imagenCarta8" destination="kHB-vu-dph" id="4Oh-f8-YQv"/>
<outlet property="imagenCarta9" destination="mkR-Ub-itz" id="Dyz-a5-gz7"/>
<outlet property="jugarBtn" destination="IRK-zS-xeX" id="Eo9-0q-9rq"/> <outlet property="jugarBtn" destination="IRK-zS-xeX" id="Eo9-0q-9rq"/>
<outlet property="resultadoObtenido" destination="yDe-2w-b0i" id="Wvs-es-KYX"/> <outlet property="resultadoObtenido1" destination="yDe-2w-b0i" id="Wvs-es-KYX"/>
<outlet property="resultadoObtenido2" destination="kLZ-vz-YQG" id="QDc-uk-T3K"/>
<outlet property="valorCarta1" destination="wZD-mq-pB7" id="u1i-Yc-40c"/> <outlet property="valorCarta1" destination="wZD-mq-pB7" id="u1i-Yc-40c"/>
<outlet property="valorCarta10" destination="d0Y-fC-k9E" id="bVF-Ri-MN2"/>
<outlet property="valorCarta2" destination="co2-G2-mvw" id="Mrg-Wb-PNZ"/> <outlet property="valorCarta2" destination="co2-G2-mvw" id="Mrg-Wb-PNZ"/>
<outlet property="valorCarta3" destination="nET-I0-wui" id="HJb-Jh-351"/> <outlet property="valorCarta3" destination="nET-I0-wui" id="HJb-Jh-351"/>
<outlet property="valorCarta4" destination="uhk-kA-oHv" id="boV-um-Q4Z"/> <outlet property="valorCarta4" destination="uhk-kA-oHv" id="boV-um-Q4Z"/>
<outlet property="valorCarta5" destination="0hO-2H-sNS" id="RnN-1k-AdP"/> <outlet property="valorCarta5" destination="0hO-2H-sNS" id="RnN-1k-AdP"/>
<outlet property="valorCarta6" destination="yLL-Ou-463" id="uY0-Dz-sO4"/>
<outlet property="valorCarta7" destination="2rw-Ry-jTo" id="hn1-Hs-roN"/>
<outlet property="valorCarta8" destination="3xy-FU-6r3" id="xLY-VW-Zoa"/>
<outlet property="valorCarta9" destination="OnF-cb-pRq" id="ofw-oY-51a"/>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-41" y="-571"/> <point key="canvasLocation" x="-41.25" y="-571.47887323943667"/>
</scene> </scene>
</scenes> </scenes>
</document> </document>
...@@ -2,86 +2,98 @@ ...@@ -2,86 +2,98 @@
// Carta.swift // Carta.swift
// poker // poker
// //
// Created by Mobile Roshka on 4/13/20. // Created by Julio Hermosa on 4/13/20.
// Copyright © 2020 Mobile Roshka. All rights reserved. // Copyright © 2020 Mobile Roshka. All rights reserved.
// //
import Foundation import Foundation
enum Palo: Int{
//se crean los palos posibles en poker (el valor de los mismos no tienen significancia en el juego)
case E = 1//espadas
case T = 2//tréboles
case C = 3//corazones
case D = 4//diamantes
}
enum Jugada: Int{
//se crean las combinaciones posibles con un valor que sirve para saber cual es la mejor jugada
case EscaleraReal = 10
case EscaleraColor = 9
case Poker = 8
case Full = 7
case Color = 6
case Escalera = 5
case Trio = 4
case ParDoble = 3
case Par = 2
case CartaAlta = 1
}
struct Carta{
var valor = Int() //se simula una baraja, que contiene hasta 52 cartas francesas
//var nombre = String() class Baraja{
var palo = Palo.self var cartas: [(Int, String)]? = []
//var palo = String() func crearBaraja(){
enum Palo: Int{ for index1 in 1...13{
case E = 1 for index2 in 1...4{ cartas!.append((index1,"\(Palo.init(rawValue: index2)!)"))
case T = 2
case C = 3
case D = 4
} }
}
}
} }
class Baraja{ //se simula que se extraen 5 cartas de una baraja para cada jugador
// var enMesa = [String]() class Manos{
var valor = [Int]() var cartasEnMano: [(Int, String)] = []
var baraja: Baraja = Baraja()
var valoresOrdenados = [Int]() var valoresOrdenados = [Int]()
var palo = [String]() var palo = [String]()
var nombreCarta = [String]() var nombreCarta = [String]()
var nombreJugada = "Carta alta" var nombreJugada:Jugada = Jugada(rawValue: 1)!
private let escalera: [Int] = [1, 10, 11, 12, 13]
//función para extraer 5 cartas y guardar la información en arrays con los valores, el palo y el nombre de la carta en caso de ser A, J, Q y K private let escaleraReal: [Int] = [1, 10, 11, 12, 13]
func extraerCartas()/*->[String]*/{
let carta = Carta.init()
//recorremos un array de 5 elementos (cada una de las cartas extraídas) //función para extraer 5 cartas y guardar la información en arrays con los valores, el palo y el nombre de la carta en caso de ser A, J, Q y K
for index in 0...4{ //la función recibe como parámetro las cartas que aun no se extrajeron para que no se repitan
//se elige al azar el palo segun el enum de palo func extraerCartas(cartasDisponibles: Baraja){
var paloCarta = carta.palo.init(rawValue: .random(in: 1...4)) baraja = cartasDisponibles
//cargamos las cartas a las manos y borramos de la baraja para que no se vuelvan a sacar
//se guarda en el array los valores de la carta y el palo for _ in 0...4 {
valor.append(Int.random(in: 1...13)) let randomNumber = Int.random(in: 0..<baraja.cartas!.count)
palo.append("\(paloCarta!)") cartasEnMano.append((baraja.cartas?[randomNumber])!)
baraja.cartas?.remove(at: randomNumber)
//se recorre por los elementos anteriores para determinar si se repitió la carta y si es así escojemos otra
for i in 0..<index{
if valor[index] == valor[i] && palo[index] == palo[i]{
valor.removeLast()
palo.removeLast()
valor.append(Int.random(in: 1...13))
paloCarta = carta.palo.init(rawValue: Int.random(in: 1...4))
palo.append("\(paloCarta!)")
}
} }
// se carga en el array auxiliar, que luego se ordenará
valoresOrdenados.append(valor[index])
for index in 0...4{
//se carga en el array el nombre de la carta, 1: A, 11:J, 12:Q y 13:K //se carga en el array el nombre de la carta, 1: A, 11:J, 12:Q y 13:K
switch valor[index] { switch cartasEnMano[index].0 {
case 1: case 1:
nombreCarta.append("A"/*+"\(paloCarta!)"*/) nombreCarta.append("A")
case 11: case 11:
nombreCarta.append("J"/*+"\(paloCarta!)"*/) nombreCarta.append("J")
case 12: case 12:
nombreCarta.append("Q"/*+"\(paloCarta!)"*/) nombreCarta.append("Q")
case 13: case 13:
nombreCarta.append("K"/*+"\(paloCarta!)"*/) nombreCarta.append("K")
default: default: nombreCarta.append("\(cartasEnMano[index].0)")
nombreCarta.append("\(valor[index])"/*+"\(paloCarta!)"*/)
} }
//se cargan en arrays los valores numéricos y los palos de las cartas extraídas de la baraja
valoresOrdenados.append(cartasEnMano[index].0)
palo.append(cartasEnMano[index].1)
} }
//ordenamos los valores, para determinar posteriormente si hay alguna combinación
valoresOrdenados.sort() valoresOrdenados.sort()
return //nombreCarta return
} }
//devuelve el nombre de la jugada segun la combinación de cartas, el array con los valores ordenados y el mayor en caso de haber una combinación
//devuelve un string con el nombre de la jugada segun la combinación de cartas func jugadas()->(Jugada, [Int], Int){
func jugadas()->String{ var cartasOrdenadas = valoresOrdenados // copiamos su contenido para cambiar el orden en caso de tener ases, ya que los mismos tambien pueden valer 14 (se evalúa para cada caso)
var mayorCombinacion = 0 //se utiliza en caso de necesitar desempate entre pares, doblepares, tríos, full y poker
var contSecuencia = 1 //Para determinar si hay una escalera
var contPalosIguales = 1 // para determinar si hay color
var cantidad: [(Int, Int)] = [(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0)] //se guarda el número de apariciones de cada valor, para determinar si hay pares, tríos o poker
var contSecuencia = 1 cantidad[valoresOrdenados[0]].1 += 1
var contPalosIguales = 1
var diccionarioCantidad: [Int: Int] = [1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0]
diccionarioCantidad[valoresOrdenados[0]]! += 1
for index in 1...4{ for index in 1...4{
if valoresOrdenados[index] == valoresOrdenados[index-1]+1{ if valoresOrdenados[index] == valoresOrdenados[index-1]+1{
contSecuencia += 1 contSecuencia += 1
...@@ -89,54 +101,89 @@ class Baraja{ ...@@ -89,54 +101,89 @@ class Baraja{
if palo[index] == palo[index-1]{ if palo[index] == palo[index-1]{
contPalosIguales += 1 contPalosIguales += 1
} }
if diccionarioCantidad[valoresOrdenados[index]] == 0{ if cantidad[valoresOrdenados[index]-1].1 == 0{
diccionarioCantidad[valoresOrdenados[index]]! += 1 cantidad[valoresOrdenados[index]-1].1 += 1
} }
if valoresOrdenados[index] == valoresOrdenados[index - 1]{ if valoresOrdenados[index] == valoresOrdenados[index - 1]{
diccionarioCantidad[valoresOrdenados[index]]! += 1 cantidad[valoresOrdenados[index]-1].1 += 1
} }
} }
if contPalosIguales == 5{ if contPalosIguales == 5{
nombreJugada = "Color" nombreJugada = .Color
if valoresOrdenados.contains(1){
cartasOrdenadas = cartasOrdenadas.filter { $0 > 1}
cartasOrdenadas.append(14)
}
} }
if contSecuencia == 5{ if contSecuencia == 5{
nombreJugada = "Escalera" nombreJugada = .Escalera
}
if valoresOrdenados == escaleraReal{
nombreJugada = .Escalera
if valoresOrdenados.contains(1){
cartasOrdenadas = cartasOrdenadas.filter { $0 > 1}
cartasOrdenadas.append(14)
} }
if valoresOrdenados == escalera{
nombreJugada = "Escalera"
} }
if nombreJugada == "Escalera" && contPalosIguales == 5 { if nombreJugada == .Escalera && contPalosIguales == 5 {
nombreJugada = "Escalera Color" nombreJugada = .EscaleraColor
} }
let poker = diccionarioCantidad.filter{ $0.value == 4} if valoresOrdenados == escaleraReal && contPalosIguales == 5 {
let trio = diccionarioCantidad.filter{ $0.value == 3} nombreJugada = .EscaleraReal
let par = diccionarioCantidad.filter{ $0.value == 2} if valoresOrdenados.contains(1){
cartasOrdenadas = cartasOrdenadas.filter { $0 > 1}
cartasOrdenadas.append(14)
}
}
let poker = cantidad.filter{ $0.1 == 4}
let trio = cantidad.filter{ $0.1 == 3}
let par = cantidad.filter{ $0.1 == 2}
if par.count == 1{ if par.count == 1{
nombreJugada = "Par" nombreJugada = .Par
mayorCombinacion = par[0].0
} }
if par.count == 2{ if par.count == 2{
nombreJugada = "Par doble" nombreJugada = .ParDoble
mayorCombinacion = par[1].0
} }
if trio.count == 1{ if trio.count == 1{
nombreJugada = "Trio" nombreJugada = .Trio
mayorCombinacion = trio[0].0
} }
if par.count == 1 && trio.count == 1{ if par.count == 1 && trio.count == 1{
nombreJugada = "Full" nombreJugada = .Full
mayorCombinacion = trio[0].0
} }
if poker.count == 1 { if poker.count == 1 {
nombreJugada = "Poker" nombreJugada = .Poker
mayorCombinacion = poker[0].0
}
if mayorCombinacion == 1{
mayorCombinacion = 14
}
if nombreJugada == .CartaAlta{
if valoresOrdenados.contains(1){
cartasOrdenadas = cartasOrdenadas.filter { $0 > 1}
cartasOrdenadas.append(14)
} }
return nombreJugada }
return (nombreJugada, cartasOrdenadas, mayorCombinacion)
} }
//eliminamos todas las modificaciones para empezar de nuevo el juego //eliminamos todas las modificaciones para empezar de nuevo el juego
func barajarCartas(){ func barajarCartas(){
valor.removeAll() baraja.cartas?.removeAll()
cartasEnMano.removeAll()
palo.removeAll() palo.removeAll()
valoresOrdenados.removeAll() valoresOrdenados.removeAll()
nombreCarta.removeAll() nombreCarta.removeAll()
nombreJugada = "Carta alta" nombreJugada = .CartaAlta
} }
......
...@@ -11,21 +11,38 @@ import UIKit ...@@ -11,21 +11,38 @@ import UIKit
class ViewController: UIViewController { class ViewController: UIViewController {
//var carta:Carta = Carta.init() //var carta:Carta = Carta.init()
var baraja:Baraja = Baraja() var baraja:Baraja = Baraja()
var mano1:Manos = Manos()
var mano2:Manos = Manos()
var resultado1: (Jugada, [Int], Int)? = nil
var resultado2: (Jugada, [Int], Int)? = nil
var ganador = String()
@IBOutlet weak var resultadoObtenido: UILabel! @IBOutlet weak var resultadoObtenido1: UILabel!
@IBOutlet weak var resultadoObtenido2: UILabel!
@IBOutlet weak var valorCarta1: UILabel! @IBOutlet weak var valorCarta1: UILabel!
@IBOutlet weak var valorCarta2: UILabel! @IBOutlet weak var valorCarta2: UILabel!
@IBOutlet weak var valorCarta3: UILabel! @IBOutlet weak var valorCarta3: UILabel!
@IBOutlet weak var valorCarta4: UILabel! @IBOutlet weak var valorCarta4: UILabel!
@IBOutlet weak var valorCarta5: UILabel! @IBOutlet weak var valorCarta5: UILabel!
@IBOutlet weak var valorCarta6: UILabel!
@IBOutlet weak var valorCarta7: UILabel!
@IBOutlet weak var valorCarta8: UILabel!
@IBOutlet weak var valorCarta9: UILabel!
@IBOutlet weak var valorCarta10: UILabel!
@IBOutlet weak var imagenCarta1: UIImageView! @IBOutlet weak var imagenCarta1: UIImageView!
@IBOutlet weak var imagenCarta2: UIImageView! @IBOutlet weak var imagenCarta2: UIImageView!
@IBOutlet weak var imagenCarta3: UIImageView! @IBOutlet weak var imagenCarta3: UIImageView!
@IBOutlet weak var imagenCarta4: UIImageView! @IBOutlet weak var imagenCarta4: UIImageView!
@IBOutlet weak var imagenCarta5: UIImageView! @IBOutlet weak var imagenCarta5: UIImageView!
@IBOutlet weak var imagenCarta6: UIImageView!
@IBOutlet weak var imagenCarta7: UIImageView!
@IBOutlet weak var imagenCarta8: UIImageView!
@IBOutlet weak var imagenCarta9: UIImageView!
@IBOutlet weak var imagenCarta10: UIImageView!
@IBOutlet weak var jugarBtn: UIButton! @IBOutlet weak var jugarBtn: UIButton!
...@@ -33,29 +50,132 @@ class ViewController: UIViewController { ...@@ -33,29 +50,132 @@ class ViewController: UIViewController {
jugar() jugar()
} }
//llamamos a las funciones relativas al juego de la clase baraja (extraer cartas, obtener la jugada y volver a barajar las cartas) //llamamos a las funciones relativas al juego de la clase Manos (extraer cartas, obtener la jugada y volver a barajar las cartas)
func jugar(){ func jugar(){
baraja.extraerCartas() baraja.crearBaraja()//creamos un mazo completo de 52 cartas
resultadoObtenido.text = baraja.jugadas()
mano1.extraerCartas(cartasDisponibles: baraja)
//se envia el array con las cartas aún disponibles
mano2.extraerCartas(cartasDisponibles: baraja)
resultado1 = mano1.jugadas()
//se guardan los resultados obtenidos en variables resultadoN
resultado2 = mano2.jugadas()
resultadoObtenido1.text = "\(mano1.jugadas().0)"
//se imprime en los labels el nombre de las jugadas para cada jugador
resultadoObtenido2.text = "\(mano2.jugadas().0)"
//cargamos los valores del array en los labels de las cartas //cargamos los valores del array en los labels de las cartas
valorCarta1.text = baraja.nombreCarta[0] valorCarta1.text = mano1.nombreCarta[0]
valorCarta2.text = baraja.nombreCarta[1] valorCarta2.text = mano1.nombreCarta[1]
valorCarta3.text = baraja.nombreCarta[2] valorCarta3.text = mano1.nombreCarta[2]
valorCarta4.text = baraja.nombreCarta[3] valorCarta4.text = mano1.nombreCarta[3]
valorCarta5.text = baraja.nombreCarta[4] valorCarta5.text = mano1.nombreCarta[4]
valorCarta6.text = mano2.nombreCarta[0]
valorCarta7.text = mano2.nombreCarta[1]
valorCarta8.text = mano2.nombreCarta[2]
valorCarta9.text = mano2.nombreCarta[3]
valorCarta10.text = mano2.nombreCarta[4]
//segun el nombre de la imagen mostramos su palo //segun el nombre de la imagen mostramos su palo
imagenCarta1.image = UIImage(named: "poker-\(baraja.palo[0])") imagenCarta1.image = UIImage(named: "poker-\(mano1.palo[0])")
imagenCarta2.image = UIImage(named: "poker-\(baraja.palo[1])") imagenCarta2.image = UIImage(named: "poker-\(mano1.palo[1])")
imagenCarta3.image = UIImage(named: "poker-\(baraja.palo[2])") imagenCarta3.image = UIImage(named: "poker-\(mano1.palo[2])")
imagenCarta4.image = UIImage(named: "poker-\(baraja.palo[3])") imagenCarta4.image = UIImage(named: "poker-\(mano1.palo[3])")
imagenCarta5.image = UIImage(named: "poker-\(baraja.palo[4])") imagenCarta5.image = UIImage(named: "poker-\(mano1.palo[4])")
imagenCarta6.image = UIImage(named: "poker-\(mano2.palo[0])")
imagenCarta7.image = UIImage(named: "poker-\(mano2.palo[1])")
imagenCarta8.image = UIImage(named: "poker-\(mano2.palo[2])")
imagenCarta9.image = UIImage(named: "poker-\(mano2.palo[3])")
imagenCarta10.image = UIImage(named: "poker-\(mano2.palo[4])")
//llamamos a la función que se encarga de elegir al ganador
elegirGanador()
mano1.barajarCartas()
//devolvemos las cartas al mazo
mano2.barajarCartas()
}
func elegirGanador(){
var valores1 = resultado1!.1
var valores2 = resultado2!.1
//comparamos las jugadas segun su ranking para elegir al ganador
if resultado1!.0.rawValue > resultado2!.0.rawValue {
ganador = "Jugador1"
}
if resultado2!.0.rawValue > resultado1!.0.rawValue{
ganador = "Jugador2"
}
//si ambas jugadas son iguales, se procede al desempate
if resultado1!.0 == resultado2!.0 {
//como se aplican métodos de desempate similares para las escaleras, color y carta alta, se procede a comparar los valores de mayor a menor
if resultado1!.0 == .CartaAlta || resultado1!.0 == .Escalera || resultado1!.0 == .EscaleraColor || resultado1!.0 == .EscaleraReal || resultado1!.0 == .Color {
while valores1.last! == valores2.last!{
valores1.removeLast()
valores2.removeLast()
}
if valores1.count > 0{
if valores1.last! > valores2.last!{
ganador = "Jugador1"
} else
if valores2.last! > valores1.last!{
ganador = "Jugador2"
}
else{
ganador = "Empate"
}
}
}
//para desempatar se elige la combinación mayor, en caso de haber empate se comparan con las cartas que no forman parte de la combinación
if resultado1!.0 == .Par || resultado1!.0 == .ParDoble || resultado1!.0 == .Trio || resultado1!.0 == .Full || resultado1!.0 == .Poker{
if resultado1!.2 > resultado2!.2{
ganador = "Jugador1"
}
if resultado2!.2 > resultado1!.2{
ganador = "Jugador2"
}
if resultado2!.2 == resultado1!.2{
while valores1.last! == valores2.last!{
valores1.removeLast()
valores2.removeLast()
}
if valores1.count > 0{
if valores1.last! > valores2.last!{
ganador = "Jugador1"
} else
if valores2.last! > valores1.last!{
ganador = "Jugador2"
}
else{
ganador = "Empate"
}
}
baraja.barajarCartas()
} }
}
}
//se muestra en una alerta quien ganó o si es empate
if ganador == "Empate" {
mostrarGanador(mensaje: "\(ganador)")
}else{
mostrarGanador(mensaje: "El ganador es: \(ganador)")
}
}
//se crea la alerta, que muestra quien ganó o si es empate
private func mostrarGanador(mensaje: String){
let alerta = UIAlertController(title: "Resultado Final", message:mensaje, preferredStyle: .alert)
alerta.addAction(UIAlertAction(title: "Aceptar", style: .default, handler: nil))
present(alerta, animated:true, completion:nil)
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment