Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pingouins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Felton Samuel
pingouins
Commits
2ecb0ccf
Commit
2ecb0ccf
authored
9 years ago
by
Bariatti Francesco
Browse files
Options
Downloads
Patches
Plain Diff
Added python wrapper of the program for visualising
parent
c4fb6ead
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/game/penguin.cpp
+1
-1
1 addition, 1 deletion
src/game/penguin.cpp
tools/gui.py
+48
-0
48 additions, 0 deletions
tools/gui.py
with
49 additions
and
1 deletion
src/game/penguin.cpp
+
1
−
1
View file @
2ecb0ccf
...
@@ -341,7 +341,7 @@ namespace game
...
@@ -341,7 +341,7 @@ namespace game
obstacles
|=
((
uint64_t
)
1
)
<<
(
state
.
p3_blue
&
63
);
obstacles
|=
((
uint64_t
)
1
)
<<
(
state
.
p3_blue
&
63
);
obstacles
|=
((
uint64_t
)
1
)
<<
(
state
.
p4_blue
&
63
);
obstacles
|=
((
uint64_t
)
1
)
<<
(
state
.
p4_blue
&
63
);
cout
<<
obstacles
;
cout
<<
obstacles
<<
endl
;
state
.
nb_moves_red
=
0
;
state
.
nb_moves_red
=
0
;
state
.
nb_moves_blue
=
0
;
state
.
nb_moves_blue
=
0
;
...
...
This diff is collapsed.
Click to expand it.
tools/gui.py
0 → 100755
+
48
−
0
View file @
2ecb0ccf
#!/usr/bin/env python3
#-*- encoding: utf-8 -*-
import
drawState
import
subprocess
import
json
import
os
if
__name__
==
"
__main__
"
:
programname
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
../bin/theturk
"
)
program
=
subprocess
.
Popen
(
programname
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
universal_newlines
=
True
,
bufsize
=
1
)
try
:
while
True
:
#READ
readloop
=
True
comments
=
[]
json_data
=
[]
brackets_count
=
0
while
readloop
:
line
=
program
.
stdout
.
readline
()
#print(line)
if
line
.
startswith
(
"
{
"
):
#in json or entering json
brackets_count
+=
1
if
brackets_count
>
0
:
#We are in the middle of json data
json_data
.
append
(
line
)
else
:
comments
.
append
(
line
)
if
line
.
startswith
(
"
}
"
):
brackets_count
-=
1
if
line
==
"
\n
"
:
readloop
=
False
#PRINT STATE
print
(
"
Comments: {}
"
.
format
(
''
.
join
(
comments
)))
state
=
json
.
loads
(
''
.
join
(
json_data
))
drawState
.
drawBitboard
(
state
[
"
bitboards
"
][
"
onefish
"
],
state
[
"
bitboards
"
][
"
twofish
"
],
state
[
"
bitboards
"
][
"
threefish
"
])
print
(
"
Red penguins
"
)
for
i
in
range
(
4
):
drawState
.
drawPenguin
(
state
[
"
penguins
"
][
"
red
"
][
i
])
print
(
"
Blue penguins
"
)
for
i
in
range
(
4
):
drawState
.
drawPenguin
(
state
[
"
penguins
"
][
"
blue
"
][
i
])
#PLAY NEXT MOVE
move
=
input
(
"
Enter next move:
"
)
program
.
stdin
.
write
(
move
+
"
\n
"
)
program
.
stdin
.
flush
()
except
KeyboardInterrupt
:
print
(
"
\n
May the fish be with you.
"
)
finally
:
program
.
kill
()
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