Coder Social home page Coder Social logo

pingpong's Introduction

PingPong Simulation

  • Author: Alex Lewtschuk

Overview

This PingPong project incorporates multithreading and socket connections to make a server and client simulate a game of ping pong. When the client and server connect there is a distributed coin toss to decide who plays first. There is also a servent version in the Servernt directory.

Compiling and Using

To run the code please use the terminal and run the command java pingpong.java <client|server> <serverHost> <port#>. Make sure that the host is always localhost.

Once the server has been set up open another terminal and with the same command specify client and the information for the server you just set up. This is how the client will connect.

To run the Servent version cd to /Servent and run the command: java PingPongServent.java 1 5005 localhost 5006 then in another terminal run java PingPongServent.java 2 5006 localhost 5005.

Please note the servent functionality of being both server|client is best demonstrated while running a third servent as there might be a bug with getting client multithreading to work I am not 100% sure.

Please open a third terminal and run: java pingpongservent.java 3 5007 localhost 5006

pingpong's People

Contributors

alewtschuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.