Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tick-Tack-Trauma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Josua Oppermann
Tick-Tack-Trauma
Commits
9b10e93c
Commit
9b10e93c
authored
2 months ago
by
Josua Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
getter and setter von Tile fix
parent
4437d3ad
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Board.java
+4
-4
4 additions, 4 deletions
Board.java
GameUI.java
+2
-2
2 additions, 2 deletions
GameUI.java
README.md
+0
-2
0 additions, 2 deletions
README.md
Tile.java
+4
-4
4 additions, 4 deletions
Tile.java
with
10 additions
and
12 deletions
Board.java
+
4
−
4
View file @
9b10e93c
...
@@ -93,11 +93,11 @@ public class Board extends Thread {
...
@@ -93,11 +93,11 @@ public class Board extends Thread {
public
boolean
victoryCheck
()
{
public
boolean
victoryCheck
()
{
boolean
victory
=
false
;
boolean
victory
=
false
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
if
(
currentPlayer
==
tiles
[
0
+
i
*
3
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
1
+
i
*
3
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
2
+
i
*
3
].
get
_o
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
0
+
i
*
3
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
1
+
i
*
3
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
2
+
i
*
3
].
get
O
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
0
+
i
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
3
+
i
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
6
+
i
].
get
_o
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
0
+
i
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
3
+
i
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
6
+
i
].
get
O
wner
())
victory
=
true
;
}
}
if
(
currentPlayer
==
tiles
[
0
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
4
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
8
].
get
_o
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
0
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
4
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
8
].
get
O
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
2
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
4
].
get
_o
wner
()
&&
currentPlayer
==
tiles
[
6
].
get
_o
wner
())
victory
=
true
;
if
(
currentPlayer
==
tiles
[
2
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
4
].
get
O
wner
()
&&
currentPlayer
==
tiles
[
6
].
get
O
wner
())
victory
=
true
;
return
victory
;
return
victory
;
}
}
}
}
This diff is collapsed.
Click to expand it.
GameUI.java
+
2
−
2
View file @
9b10e93c
...
@@ -131,10 +131,10 @@ public class GameUI extends Application{
...
@@ -131,10 +131,10 @@ public class GameUI extends Application{
* @param stage current scene
* @param stage current scene
*/
*/
private
void
handleTurn
(
int
index
,
Stage
stage
){
private
void
handleTurn
(
int
index
,
Stage
stage
){
if
(
board
.
tiles
[
index
].
exist
_o
wner
())
{
if
(
board
.
tiles
[
index
].
exist
O
wner
())
{
return
;
return
;
}
}
board
.
tiles
[
index
].
set
_o
wner
(
board
.
currentPlayer
);
board
.
tiles
[
index
].
set
O
wner
(
board
.
currentPlayer
);
//replace symbols with images
//replace symbols with images
String
imageSymbols
=
board
.
currentPlayer
==
0
?
getClass
().
getResource
(
"/textures/1_"
+
rnd
.
nextInt
(
3
)
+
".png"
).
toExternalForm
()
:
String
imageSymbols
=
board
.
currentPlayer
==
0
?
getClass
().
getResource
(
"/textures/1_"
+
rnd
.
nextInt
(
3
)
+
".png"
).
toExternalForm
()
:
...
...
This diff is collapsed.
Click to expand it.
README.md
+
0
−
2
View file @
9b10e93c
# Tick-Tack-Trauma
# Tick-Tack-Trauma
## Getting started
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
...
...
This diff is collapsed.
Click to expand it.
Tile.java
+
4
−
4
View file @
9b10e93c
...
@@ -11,7 +11,7 @@ public class Tile {
...
@@ -11,7 +11,7 @@ public class Tile {
* -1 = no one; 0 = Player 1; 1 = Player 2
* -1 = no one; 0 = Player 1; 1 = Player 2
* @param owner
* @param owner
*/
*/
public
void
set
_o
wner
(
int
player
){
public
void
set
O
wner
(
int
player
){
owner
=
player
;
owner
=
player
;
}
}
...
@@ -19,20 +19,20 @@ public class Tile {
...
@@ -19,20 +19,20 @@ public class Tile {
* -1 = no one; 0 = Player 1; 1 = Player 2
* -1 = no one; 0 = Player 1; 1 = Player 2
* @return owner
* @return owner
*/
*/
public
int
get
_o
wner
(){
public
int
get
O
wner
(){
return
owner
;
return
owner
;
}
}
/**Returns if the Tile-owner is equal to the given Player
/**Returns if the Tile-owner is equal to the given Player
* @param owner
* @param owner
*/
*/
public
boolean
is
_o
wner
(
int
player
){
public
boolean
is
O
wner
(
int
player
){
return
owner
==
player
;
return
owner
==
player
;
}
}
/**Whether this Tile is owned by a Player
/**Whether this Tile is owned by a Player
*/
*/
public
boolean
exist
_o
wner
(){
public
boolean
exist
O
wner
(){
return
owner
!=
-
1
;
return
owner
!=
-
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment