
-----------------------------------
Buen
Fri Jan 07, 2005 5:17 pm

Euchre
-----------------------------------
Has anyone attempted or succesfully done Euchre with turing? I've been working on it for a couple weeks now and have gotten stuck on the best way to create my deck... I've tried using 4 seperate arrays (One for each suit) one array from 1..24. Each one I get stuck on how to keep track of trump and also left and right bowers. Would a 2 dimensional array work in any way shape or form maybe?

..Im more just curious if Euchre can even be done :shock:

-----------------------------------
SuperGenius
Fri Jan 07, 2005 5:40 pm


-----------------------------------
of course it is possible. 

you could have an array of 1 to 24 or even a 6 by 4 2d array. each element would have an integer value representing the 'power' of the card. then it would just be a simple matter of increasing the number for the appropriate cards after trump selection.

-----------------------------------
Cervantes
Fri Jan 07, 2005 5:52 pm


-----------------------------------
Yes, Euchre can be done.  Anything can be done :)  Making your deck shouldn't be too difficult.
A two dimensional array would be pretty much the same as having four seperate arrays, though more organized.  If you can't get four seperate arrays to work, you'll probably have trouble with a two dimensional array.

Hmm, I wonder if a 
%0 .. 5 is the number of the card (9, 10, j, q, k, a)
%0 .. 3 is the suit
var deck : flexible array 0 .. 5, 0 .. 3 of int
%initialize the deck

%add one to trump.  Say trump is suit #1
new deck, 6, 1
deck (6, 1) := deck (2, 0) %make the new element to the deck equal the value for the left bower

%take one away from the same colour suit that isn't trump
for r : 2 + 1 .. 5
    deck (r - 1, 0) := deck (r, 0)
end for
new deck, 4, 0


That's some pretty confusing code right there, for you.  Hopefully, you'll be able to understand it.  (It should be easier if you read the tutorial).  I didn't really do much for the above code: it's more of an idea representation than actual to-be-used code. :wink:

-----------------------------------
Buen
Mon Jan 10, 2005 11:55 am


-----------------------------------
I see how a 2D array would work. At first my 4 seperate arrays held "strings" and had the name of each card. Now that I have an array, I have put the value of the card in there instead. I see now that the computer is not looking at the name of the cards and is reading them for their value (it's "power").

My next question is how to keep track of hands. I am thinking of 5 arrays (4 hands and the crib). In the array for the hand, this work?


var hand1 : array 1 .. 5 of int
var hand2 : array 1 .. 5 of int
var hand3 : array 1 .. 5 of int
var hand4 : array 1 .. 5 of int

Each element in the array would hold the power of the certain card? Im just not sure how to keep track of what card is in each player's hand by suit. Because there are 4 different suit's for each value...

EDIT: As I posted this I thought of something else...If my luck might work if I used another two dimensional array to keep track of where the cards are?


var cardlocations : array 1..6, 1..4 of int


Each element would contain a number, 1 being players hand, 2 being player 2's hand, up to 5 being the crib/kitty/whatever. I'll keep fiddling with things, but any input would be helpful to steer me in right direction. Also thanks already for what you have told me! The flexible array Im not using in this euchre game, but it helped me in another program that I was working on.

-----------------------------------
Cervantes
Mon Jan 10, 2005 9:26 pm


-----------------------------------
Do you even need to have an array for locations?  What about having just one 2D array.  One dimension of the array is for suit, the other is for number.  With those two pieces of information, you can determine the 'power' of the card.  Assign the array element some value to keep track of its location.
I don't know if that would work; I haven't done much in the way of cards.  Just throwing ideas out :)
-Cervantes

-----------------------------------
Buen
Thu Jan 13, 2005 11:50 am


-----------------------------------
I have used one flexible array now, I like how your idea on removing and adding to the trump section. Though it poses yet another problem Im still aiming to fix.

var cardlocation : flexible array 9 .. 14, 1 .. 4 of int

9-14 being the card value.. and 1..4 being the suits.

Each element in the array is either:

0 (For the kitty)
1 (Player 1's Hand)
2 (Player 2's Hand)
3 (Player 3's Hand)
4 (Player 4's Hand)

..How would I keep track of the power increase to those cards without changing locations... :shock:

-----------------------------------
Buen
Fri Jan 14, 2005 12:12 pm


-----------------------------------
I put in the flexible array and this is what I get as a programmer present, It tells me that it is not yet implemented in the version of turing I got and it even apologizes...

-----------------------------------
scottyrush13
Fri Jan 14, 2005 12:19 pm


-----------------------------------
lol it said "complex flexible array not implemented in this version- sorry"

quite humourous

-----------------------------------
Buen
Fri Jan 21, 2005 11:55 am


-----------------------------------
I have gotten this far, I have the first hand being played. I have sifted through the last few blocks of if and for statements all week and cannot see why the computer ends up outputting hands that isnt even their's?
