replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Client-Server game of TicTacToe?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Client-Server game of TicTacToe?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Fri Oct 26, 2012 7:56 pm    Post subject: Client-Server game of TicTacToe? Reply with quote

Best way to realize two player Client-Server game of TicTacToe using FTN95, ClearWin+ and .NET?

I have written this game before for Inferno using Limbo programming language. It was quite easy task because of lightweight threads (procs), blocking channels for thread synchronization + communication and filesystem interface for network sockets.

Available here, if someone is interested


For FTN95-version of a game I thought about using .NET framework for threading and socket connection handling.

For server, I guess I will be using three threads:

UI_thread:
Handles user interaction. Starts the Listen_thread (don't want to block the UI_thread).

Listen_thread:
Listens and accept opponents connection. Starts the Worker_thread and then goes away.

Worker_thread:
Handles opponents connection, moves and messages.

For player turn and thread synchronization, I thought about using just a variable:

Lets name the variable: lambda

Lambda can have values: '1' or '-1'.

'1' means local players turn and '-1' means opponents turn. If we mark the local players pieces on the game board with '1' and opponents pieces with '-1', then we can test if a game piece on the board belongs to the current player or for the opponent by just multiplying piece value by lambda. Positive value means current player and negative value means opponent. So, no need for separate testing functions for each player.

Since lamba variable needs to be accessed from the two different threads: UI_thread and Worker_thread, is it enough just to use LOCK when writing to a variable or do I need more sophisticated locking?
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2927
Location: South Pole, Antarctica

PostPosted: Mon Nov 05, 2012 9:11 pm    Post subject: Reply with quote

Inferno Limbo...hollly....Experience says that the more marginal languages program uses the less will be its lifespan. The same functionality using only Clearwin/Fortran and may be just a Netcat or other client-server DLL wrapped into Fortran and only Fortran would be really interesting. Something alone the lines like in here http://forums.silverfrost.com/viewtopic.php?t=1429
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group