back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md46
-rw-r--r--client/client.c4
-rw-r--r--durak.pngbin0 -> 26175 bytes
3 files changed, 48 insertions, 2 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a7d1a5a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,46 @@
+# Siege durak/Podkidnoy (Throw-in) durak
+
+<img src="durak.png" />
+
+## Description
+
+Network game. Client and server are written in pure C.
+For network communication the socket system with TCP/IP protocol is used. Due to this it is possible to use streaming through read and write system calls, and there is a guarantee that the data will arrive in strict order.
+The client and server are written in an event-driven programming model. Events are selected using the select system call, thus multiplexing I/O.
+
+GUI: console version.
+Card suits are labeled as %, #, v, ^.
+Card ranks: 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, J, Q, K, A.
+There are several stages: attacking, defending, and tossing cards. Unlike classic Fool's game, here you can toss cards depending on the reaction of the players --- whoever has time to toss a card, that card goes on the table.
+
+There are hints to help players.
+
+ * When attacking: those cards that have the same ranks (or all of them).
+ * When defending: those cards that can be used to beat back the attacking card on the table (higher rank, or with a trump suit).
+ * When tossing: those cards that have the same rank.
+
+It is possible to give up defense and accept attacking cards -- then press enter. It is also possible to discard the toss -- also press enter.
+The server analyzes whether the defender can fight back. If so, the server analyzes whether the defender can fight back. The defender is shown one card at a time (the others see all cards), which he must defeat. If the server decides that the defender does not have any cards that can be used to fight off the attacking cards, then the tossing phase is analyzed. If the other players (except the defender, of course) have cards with the same rank as on the table, then the player moves to the tossing phase, otherwise the player moves to a new attack phase.
+
+## Building
+
+### On Linux (MacOS, FreeBSD, Android)
+
+```
+git clone https://git.scratko.xyz/durak
+cd client
+```
+
+To connect to the current game server (scratko.xyz), do the following:
+ - open the client.c file with any text editor.
+ - In line 14, change the ip from `127.0.0.1` to `109.107.161.30`
+
+```
+make
+./client
+```
+
+### On Windows
+
+You can download the built version for the Windows platform (it already contains the IP address for connecting to this server).
+Windows version: <a href="https://scratko.xyz/games/durak.exe" target="_blank">Download</a>
diff --git a/client/client.c b/client/client.c
index dbe2bf1..20279d8 100644
--- a/client/client.c
+++ b/client/client.c
@@ -171,7 +171,7 @@ static void change_client_frame(struct client *cl)
}
}
-static int check_users_exti(enum client_states state, const char *buffer,
+static int check_users_exit(enum client_states state, const char *buffer,
int size)
{
if((state == first_player || state == confirmation_waiting) &&
@@ -187,7 +187,7 @@ static void send_data_to_server(struct client *cl, fd_set *readfds)
if(FD_ISSET(0, readfds)) { /* 0 - stdin */
data_size = read(0, cl->buffer, max_buffer_size);
- if(check_users_exti(cl->state, cl->buffer, data_size)) {
+ if(check_users_exit(cl->state, cl->buffer, data_size)) {
close(cl->fd);
clean_up_resources(cl);
pgf_disconnect();
diff --git a/durak.png b/durak.png
new file mode 100644
index 0000000..77815ea
--- /dev/null
+++ b/durak.png
Binary files differ