-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joe Hill
committed
Mar 24, 2017
1 parent
35cfc98
commit ce184a7
Showing
18 changed files
with
225 additions
and
58 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package model; | ||
|
||
public class CharityTile extends Tile | ||
{ | ||
|
||
public CharityTile(String type, int boardIndex) | ||
{ | ||
super(type, boardIndex); | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package model; | ||
|
||
public class ChildTile extends Tile | ||
{ | ||
public ChildTile(String type, int boardIndex) | ||
{ | ||
super(type, boardIndex); | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package model; | ||
|
||
public class DealTile extends Tile | ||
{ | ||
public DealTile(String type, int boardIndex) | ||
{ | ||
super(type, boardIndex); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package model; | ||
|
||
public class DoodadTile extends Tile | ||
{ | ||
public DoodadTile(String name, int boardIndex) | ||
{ | ||
super(name, boardIndex); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
package model; | ||
|
||
import java.util.LinkedList; | ||
import java.util.Queue; | ||
|
||
public class GameBoard | ||
{ | ||
private Tile[] _gameTiles; | ||
private TileCircularLinkedList _tiles; | ||
|
||
private static Tile t1 = new DealTile("Deal Tile", 0); | ||
private static Tile t2 = new DoodadTile("Doodad", 1); | ||
private static Tile t3 = new DealTile("Deal", 2); | ||
private static Tile t4 = new CharityTile("Charity", 3); | ||
|
||
|
||
|
||
public GameBoard() | ||
{ | ||
_tiles = new TileCircularLinkedList(); | ||
_tiles.addTiles(t1, t2, t3, t4); | ||
} | ||
|
||
|
||
|
||
// This class should have an array of tiles that goes back to the beginning when it reaches the end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package model; | ||
|
||
public class PaydayTile extends Tile | ||
{ | ||
public PaydayTile(String type, int boardIndex) | ||
{ | ||
super(type, boardIndex); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package model; | ||
|
||
public class TileCircularLinkedList | ||
{ | ||
class Node { | ||
Tile t; | ||
Node next; | ||
public Node(Tile tile) { | ||
this.t = tile; | ||
} | ||
public Node getNext() { | ||
return next; | ||
} | ||
public Tile getData() { | ||
return t; | ||
} | ||
} | ||
|
||
public int size =0; | ||
public Node head=null; | ||
public Node tail=null; | ||
|
||
//add a new node at the start of the linked list | ||
public void addNodeAtStart(Tile tile){ | ||
Node n = new Node(tile); | ||
if(size==0){ | ||
head = n; | ||
tail = n; | ||
n.next = head; | ||
}else{ | ||
Node temp = head; | ||
n.next = temp; | ||
head = n; | ||
tail.next = head; | ||
} | ||
size++; | ||
} | ||
|
||
|
||
public void addNodeAtEnd(Tile tile){ | ||
if(size==0){ | ||
addNodeAtStart(tile); | ||
}else{ | ||
Node n = new Node(tile); | ||
tail.next =n; | ||
tail=n; | ||
tail.next = head; | ||
size++; | ||
} | ||
} | ||
|
||
public void deleteNodeFromStart(){ | ||
if(size==0){ | ||
System.out.println("List is Empty"); | ||
}else{ | ||
head = head.next; | ||
tail.next=head; | ||
size--; | ||
} | ||
} | ||
|
||
public Node get(int index){ | ||
if(index>size){ | ||
return null; | ||
} | ||
Node n = head; | ||
while(index-1!=0){ | ||
n=n.next; | ||
index--; | ||
} | ||
return n; | ||
} | ||
|
||
public Tile elementAt(int index){ | ||
if(index>size){ | ||
return null; | ||
} | ||
Node n = head; | ||
while(index-1!=0){ | ||
n=n.next; | ||
index--; | ||
} | ||
return n.t; | ||
} | ||
|
||
//print the linked list | ||
public void print(){ | ||
Node temp = head; | ||
if(size<=0){ | ||
System.out.print("List is empty"); | ||
}else{ | ||
do { | ||
System.out.print(" " + temp.t.getName()); | ||
temp = temp.next; | ||
} | ||
while(temp!=head); | ||
} | ||
System.out.println(); | ||
} | ||
|
||
//get Size | ||
public int getSize(){ | ||
return size; | ||
} | ||
|
||
|
||
public void addTiles(Tile... tiles) | ||
{ | ||
for(Tile t : tiles) | ||
{ | ||
this.addNodeAtEnd(t); | ||
} | ||
|
||
} | ||
|
||
} |