Friday, 4 April 2014

Soo confuzzled

I'm not sure what I'm doing wrong because the values are showing up 8 times. And I'm not sure how to get the insert method or delete method because Ryk is assuming that there is a ".link();" method that exists to find out what that links to.

So I've also found out what was wrong when I initially created it  - I created the Mahjong things individually rather than one wall. And I forgot to quadruple all of the other values which means that it was only creating it once.

Anyways, so I've created it :) 

Tuesday, 1 April 2014

EXCITING!

Okay, yeah. This is so exciting because it's actually working!

Here's the output code (from all the tracing statements)


Code
Meaning
run:

creating deck...

shuffling deck...

34

Showing the Cards Dealt

Suit: BValue: 7 Faceup: false
Bamboo 7
Suit: NValue: 3 Faceup: false
Number 3
Suit: CValue: 8 Faceup: false
Circle 8
Suit: BValue: 5 Faceup: false
Bamboo 5
Suit: CValue: 5 Faceup: false
Circle 5
Suit: DValue: 2 Faceup: false
Direction 2: South
Suit: DValue: 1 Faceup: false
Direction 1: East
Suit: OValue: 1 Faceup: false
Other 1: Blank Space
Suit: DValue: 4 Faceup: false
D4: North
Suit: OValue: 3 Faceup: false
Other 3: Red Centre
Suit: CValue: 4 Faceup: false
Circle 4
Suit: CValue: 6 Faceup: false
Circle 6
Suit: BValue: 9 Faceup: false
Bamboo 9
creating deck...

shuffling deck...

34

Showing the Cards Dealt

Suit: OValue: 3 Faceup: false
Other 3: Red Centre
Suit: DValue: 1 Faceup: false
Direction 1: East
Suit: BValue: 7 Faceup: false
Bamboo 7
Suit: CValue: 3 Faceup: false
Circle 3
Suit: CValue: 8 Faceup: false
Circle 8
Suit: OValue: 2 Faceup: false
Other 2: Prosperity
Suit: BValue: 5 Faceup: false
Bamboo 5
Suit: NValue: 8 Faceup: false
Number 8
Suit: DValue: 4 Faceup: false
Direction 4: North
Suit: NValue: 6 Faceup: false
Number 6
Suit: OValue: 1 Faceup: false
Other 1: Blank Space
Suit: DValue: 3 Faceup: false
Direction 3: West
Suit: BValue: 6 Faceup: false
Bamboo 6
creating deck...

shuffling deck...

34

Showing the Cards Dealt

Suit: NValue: 2 Faceup: false
Number 2
Suit: BValue: 9 Faceup: false
Bamboo 9
Suit: DValue: 4 Faceup: false
Direction 4: North
Suit: CValue: 3 Faceup: false
Circle 3
Suit: NValue: 6 Faceup: false
Number 6
Suit: BValue: 7 Faceup: false
Bamboo 7 
Suit: OValue: 1 Faceup: false
Other 1: Blank Space
Suit: CValue: 6 Faceup: false
Circle 6
Suit: BValue: 6 Faceup: false
Bamboo 6
Suit: CValue: 2 Faceup: false
Circle 2
Suit: NValue: 1 Faceup: false
Number 1
Suit: OValue: 3 Faceup: false
Other 3: Red Centre
Suit: CValue: 7 Faceup: false
Circle 7
Except that for some reason, it's creating 8 linked lists, so I have to change that bit - but other than that it's good so far! HURRAY!


Monday, 31 March 2014

Tiles

Okay, so I know what I have to do - at least so far.

I've just taken screenshots of all the tiles from the following link.

And so I'll have to create one "wall" that would represent the four that would have been shown. Just mirroring the deck class, I would have to create a linked list using the following information: Suit, Style, and ImageIcon (which are all done in the folder(s)).

After, I should run a shuffle method which will shuffle the class - hopefully 2000 times or so?

Then, I can separate that deck (using the takeCard) method into 4 separate linked lists for the player's hand(s).


Monday, 24 March 2014

Creating LinkedList

So I asked Ryk to give me an example, and he created:

Main Class is called Quack (and will have to create a linked list using the list class).

Inside the List Class: 

class List {

Node head;

List()
{
head=null;
}

public void insert(String n, String p, int a, String b)
{
Node newNode = Node(n,p,a,b);

if(head==null) head=newNode;
else
{

}
}

}

Inside the Node Class: 


class Node {
String name;
String phoneNumber;
int age;
String birthday;
Node next;
Node(String n, String p, int a, String b)
{
name=n;
phoneNumber=p;
age=a;
birthday=b;
}
}

In other words, when you create a linked list thing, you have to use the "LIST" Class...

Monday, 17 March 2014

Linked List(s)

Okay, so I'm thinking about the Linked List Thing, and the 5.01 lesson shows an example using a separate class. I suppose that means that I can use the Java Linked List Class.

So each tile has to contain the following information: 
  • Style 
    • Bamboo (1-9)  suit = 0. number = valueOfThing
    • Stones (1-9)  suit = 1. number = valueOfThing
    • Numbers (1-9)  suit = 2. number = valueOfThing
    • Directions  suit = 3.  
      • North number = 0;
      • East number = 1
      • South number = 2
      • West number = 3
    • Other   suit = 4. 
      • Prosperity number = 0
      • Red Centre number = 1
      • White blank number = 2
There will also have to be 2 dice values that show up on the screen (will definitely be on a gooey). 

So each of the hand(s) is a separate array list, and the tile(s) that you pick from is also one. 

I'm also going to need the following buttons: 
  • Pong (take it to get a triple)
  • Sheung  (take it to get a consecutive number)
  • Gong (take it to get 4 in a row)
  • Sik Woo (win!) 



Planning

So I've been thinking a bit about this program, and I'm thinking...

Four linked lists (or a 2D array of them) is going to be needed to represent the player's hands, and one that represents the big 'deck' out there.

So every time a user wants to pick up a tile, then I will have to take the top thing off of the list. I'm not going to worry too much about graphics now, because it's a lot of work to remove each tile.

And every time the user pairs something up (like an eye or a triplet), the user has to choose one to throw out (perhaps a drop down menu or pressing on the physical tiles), and then the list has to be resorted again so it is all in the right order.

Perhaps something more like this (http://fs02.androidpit.info/ass/x90/11319390-1379636282506.jpg), where you don't have to use the 144 tile-thing...that's a lot of work, and unless I'm making an app (which I will eventually convert it over), but it's too much work for a project due so soon.