Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
96f8c8bb
Commit
96f8c8bb
authored
Dec 04, 2020
by
quentin.vrel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testing chow
parent
d6504fda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
Hand.vue
frontend/src/components/Hand.vue
+3
-1
HandModel.js
frontend/src/model/HandModel.js
+8
-5
No files found.
frontend/src/components/Hand.vue
View file @
96f8c8bb
...
@@ -21,12 +21,13 @@ export default {
...
@@ -21,12 +21,13 @@ export default {
}
}
},
},
mounted
(){
mounted
(){
let
startingHand
=
[
8
,
11
,
11
,
14
,
16
,
7
,
4
,
5
,
20
,
21
,
22
,
6
,
0
];
let
startingHand
=
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
25
,
26
,
27
,
28
,
29
,
30
,
31
,
32
,
8
,
11
,
11
,
14
,
16
,
7
,
4
,
5
,
20
,
21
,
22
,
6
,
0
];
this
.
Hand
=
new
Hand
();
this
.
Hand
=
new
Hand
();
startingHand
.
forEach
(
tile
=>
{
startingHand
.
forEach
(
tile
=>
{
this
.
Hand
.
draw
(
new
TileModel
(
tile
));
this
.
Hand
.
draw
(
new
TileModel
(
tile
));
});
});
this
.
Hand
.
sort
();
this
.
Hand
.
sort
();
console
.
log
(
this
.
Hand
.
checkChow
());
},
},
updated
(){
updated
(){
},
},
...
@@ -34,6 +35,7 @@ export default {
...
@@ -34,6 +35,7 @@ export default {
tileClickedListener
:
function
(
event
){
tileClickedListener
:
function
(
event
){
let
dicarded
=
this
.
Hand
.
discard
(
event
.
id_tuile
);
let
dicarded
=
this
.
Hand
.
discard
(
event
.
id_tuile
);
console
.
log
(
dicarded
);
console
.
log
(
dicarded
);
console
.
log
(
this
.
Hand
.
checkChow
());
}
}
}
}
}
}
...
...
frontend/src/model/HandModel.js
View file @
96f8c8bb
...
@@ -34,14 +34,17 @@ export default class Hand{
...
@@ -34,14 +34,17 @@ export default class Hand{
//
//
checkChow
(){
checkChow
(){
this
.
sort
();
this
.
sort
();
let
chowArray
=
[];
const
tile_ids
=
this
.
tiles_left
.
map
(
tile
=>
tile
.
id_tuile
);
const
tile_ids
=
this
.
tiles_left
.
map
(
tile
=>
tile
.
id_tuile
);
let
current_tile
=
-
1
;
tile_ids
.
forEach
(
unique_tile
=>
{
tile_ids
.
forEach
(
tile_id
=>
{
if
(
unique_tile
<
7
||
(
8
<
unique_tile
&&
unique_tile
<
16
)
||
(
17
<
unique_tile
&&
unique_tile
<
25
))
{
//bamboo <8 || char <8 || dot <8
if
(
tile_id
>
current_tile
){
if
((
tile_ids
.
indexOf
(
unique_tile
+
1
)
&&
tile_ids
.
indexOf
(
unique_tile
+
2
))
!=
-
1
)
{
current_tile
=
tile_id
;
chowArray
.
push
(
unique_tile
)
}
}
}
//WIP
});
});
return
chowArray
;
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment