Skip to content

Commit

Permalink
finally working on the server
Browse files Browse the repository at this point in the history
  • Loading branch information
sabhi2257 committed Sep 17, 2018
1 parent f06cf96 commit 9a5161b
Show file tree
Hide file tree
Showing 19 changed files with 1,867,902 additions and 45 deletions.
Binary file modified Communicator.pyc
Binary file not shown.
40 changes: 28 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
CXX = g++ -std=c++11
LFLAGS = -m64
CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) -Wno-sign-compare -Wno-unused-result-Wno-unused-variable-Wno-parameter -L /lib64
CXX = g++ -O3 -std=c++11

new_main : new_main.o player.o board.o
$(CXX) $(LFLAGS) -o new_main new_main.o player.o board.o
server_main: server_main.o player.o board.o
$(CXX) -o server_main server_main.o player.o board.o

new_main.o : new_main.cpp board.h player.h
$(CXX) $(CXXFLAGS) -c new_main.cpp
server_main.o: server_main.cpp board.h player.h
$(CXX) -c server_main.cpp

player.o : player.cpp player.h board.h
$(CXX) $(CXXFLAGS) -c player.cpp
player.o: player.cpp player.h board.h
$(CXX) -c player.cpp

board.o : board.cpp board.h
$(CXX) $(CXXFLAGS) -c board.cpp
board.o: board.cpp board.h
$(CXX) -c board.cpp


.PHONY: clean
clean:
$(RM) new_main *.o *~
$(RM) server_main *.o *~


# new_main: new_main.o player.o board.o
# $(CXX) -o new_main new_main.o player.o board.o

# new_main.o: new_main.cpp board.h player.h
# $(CXX) -c new_main.cpp

# player.o: player.cpp player.h board.h
# $(CXX) -c player.cpp

# board.o: board.cpp board.h
# $(CXX) -c board.cpp


# .PHONY: clean
# clean:
# $(RM) new_main *.o *~
2 changes: 1 addition & 1 deletion automat.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
gnome-terminal --command="python server.py 10000 -n 5 -NC 2 -TL 150 -LOG server.log"&
gnome-terminal --command="python client.py 0.0.0.0 10000 RandomPlayer.py -mode GUI"&
gnome-terminal --command="python client.py 0.0.0.0 10000 RandomPlayer.py"
gnome-terminal --command="python client.py 0.0.0.0 10000 run.sh"
Binary file modified board.o
Binary file not shown.
Binary file modified game.pyc
Binary file not shown.
76 changes: 76 additions & 0 deletions invalid_move_game1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

-> You are player 2
-> You are alloted a time of 150s

***********************************

Player 1 played : P 0 0
Time remaining is: 150s
You played : P 1 0
Player 1 played : P 1 1
Time remaining is: 150s
You played : P 1 2
Player 1 played : P 1 3
Time remaining is: 150s
You played : P 1 4
Player 1 played : P 1 5
Time remaining is: 150s
You played : P 2 0
Player 1 played : P 2 1
Time remaining is: 150s
You played : P 2 2
Player 1 played : S 1 1 M 2 3
Time remaining is: 150s
You played : S 1 0 M 2 11
Player 1 played : S 2 3 M 2 4
Time remaining is: 149s
You played : S 2 11 M 3 17
Player 1 played : S 2 4 M 3 7
Time remaining is: 148s
You played : S 3 17 M 4 23
Player 1 played : S 3 7 M 4 10
Time remaining is: 147s
You played : S 4 23 M 5 29
Player 1 played : S 4 10 M 5 13
Time remaining is: 146s
You played : S 1 2 M 3 6
Player 1 played : S 5 13 M 4 11
Time remaining is: 145s
You played : S 5 29 M 4 0
Player 1 played : S 4 11 M 3 8
Time remaining is: 144s
You played : S 4 0 M 3 0
Player 1 played : S 1 3 M 2 5
Time remaining is: 142s
You played : S 3 0 M 3 1
Player 1 played : S 0 0 M 2 6
Time remaining is: 141s
You played : S 3 6 M 3 5
Player 1 played : S 2 6 M 3 9
Time remaining is: 141s
You played : S 3 1 M 4 1
Player 1 played : S 3 9 M 3 11
Time remaining is: 140s
You played : S 4 1 M 5 1
Player 1 played : S 3 11 M 3 16
Time remaining is: 139s
You played : S 5 1 M 5 2
Player 1 played : S 3 16 M 4 21
Time remaining is: 138s
You played : S 5 2 M 4 2
Player 1 played : S 4 21 M 5 26
Time remaining is: 138s
You played : S 4 2 M 3 2
Player 1 played : S 5 26 M 4 20
Time remaining is: 137s
You played : S 3 2 M 3 3
Player 1 played : S 2 1 M 4 3
Time remaining is: 137s
You played : S 3 3 M 3 4
Player 1 played : S 3 8 M 5 14
Time remaining is: 136s
You played : S 3 4 M 4 6
Player 1 played : S 1 5 M 4 8 RS 5 13 RE 2 3 X 4 20
Time remaining is: 136s
You played : S 2 0 M 4 22 RS 1 3 RE 3 0 X 4 6 RS 0 0 RE 4 0 X 4 6
INVALID MOVE ON THIS CLIENT
51 changes: 51 additions & 0 deletions mainout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
letsgo
P 1 0
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 2 0
P 2 1
P 2 2
S 1 1 M 2 3
S 1 0 M 2 11
S 2 3 M 2 4
S 2 11 M 3 17
S 2 4 M 3 7
S 3 17 M 4 23
S 3 7 M 4 10
S 4 23 M 5 29
S 4 10 M 5 13
S 1 2 M 3 6
S 5 13 M 4 11
S 5 29 M 4 0
S 4 11 M 3 8
S 4 0 M 3 0
S 1 3 M 2 5
S 3 0 M 3 1
S 0 0 M 2 6
S 3 6 M 3 5
S 2 6 M 3 9
S 3 1 M 4 1
S 3 9 M 3 11
S 4 1 M 5 1
S 3 11 M 3 16
S 5 1 M 5 2
S 3 16 M 4 21
S 5 2 M 4 2
S 4 21 M 5 26
S 4 2 M 3 2
S 5 26 M 4 20
S 3 2 M 3 3
S 2 1 M 4 3
S 3 3 M 3 4
S 3 8 M 5 14
S 3 4 M 4 6
S 1 5 M 4 8 RS 5 13 RE 2 3 X 4 20
S 2 0 M 4 22 RS 1 3 RE 3 0 X 4 6
3
move:S 3 3 M 3 4
S 3 8 M 5 14
move:S 3 4 M 4 6
S 1 5 M 4 8 RS 5 13 RE 2 3 X 4 20
Binary file modified nbstreamreader.pyc
Binary file not shown.
Binary file modified new_main
Binary file not shown.
30 changes: 23 additions & 7 deletions new_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ int main()
player p(1);

p.execute_move(1,"P 0 0" , b);
p.execute_move(2,"P 1 5" , b);
p.execute_move(2,"P 4 14" , b);

p.execute_move(1,"P 1 0" , b);
p.execute_move(2,"P 3 4" , b);
p.execute_move(1,"P 1 1" , b);
p.execute_move(2,"P 1 3" , b);
p.execute_move(1,"P 1 2" , b);
p.execute_move(2,"P 1 4" , b);
p.execute_move(1,"P 2 6" , b);
p.execute_move(2,"P 2 11" , b);
p.execute_move(1,"P 2 7" , b);
p.execute_move(2,"P 2 10" , b);
p.execute_move(2,"P 5 7" , b);
p.execute_move(1,"P 1 4" , b);
p.execute_move(2,"P 3 3" , b);
// p.execute_move(1,"P 2 1" , b);
// p.execute_move(1,"P 3 1" , b);

Expand All @@ -28,7 +28,23 @@ int main()
// p.execute_move(1,"S 1 0 M 0 0" , b);
print_board(b);

//vector<string> v = p.generate_neighbour(1 , b);
p.execute_move(1,"S 0 0 M 1 5" , b);
p.execute_move(2,"S 3 4 M 3 6" , b);
p.execute_move(1,"S 1 5 M 2 11" , b);
p.execute_move(2,"S 1 3 M 2 5" , b);
p.execute_move(1,"S 2 11 M 3 17" , b);
p.execute_move(2,"S 4 14 M 5 21" , b);
p.execute_move(1,"S 3 17 M 4 23" , b);
p.execute_move(2,"S 5 21 M 5 23" , b);

print_board(b);

vector<string> v = p.generate_neighbour(1 , b);
for(int i=0;i<v.size();i++){
cout<<v[i]<<endl;
}
vector< std::vector<pair<pii,pii> > > fr = b.find_row();
cout<<fr[0].size()<<"shbd"<<fr[1].size()<<endl;
string str = p.generate_move(1,b);
cout << str << "here"<<endl ;

Expand Down
Binary file removed new_main.o
Binary file not shown.
Loading

0 comments on commit 9a5161b

Please sign in to comment.