parent
b4cb4dd8f1
commit
024eda3e2c
@ -1,51 +0,0 @@
|
|||||||
function sdf(){
|
|
||||||
window.alert("lksjdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function creerPartie(){
|
|
||||||
localStorage.setItem("nomJoueur", "J1");
|
|
||||||
}
|
|
||||||
|
|
||||||
function affichage(){
|
|
||||||
document.getElementById("instructions").innerHTML = localStorage.getItem("nomJoueur");
|
|
||||||
if( localStorage.getItem("nomJoueur") == 'J1'){
|
|
||||||
document.getElementById("messages").innerHTML = "Tu joues les croix"
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
document.getElementById("messages").innerHTML = "Tu joues les ronds"
|
|
||||||
window.alert(localStorage.getItem("nomJoueur"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function ValidateEmail(entre)
|
|
||||||
{
|
|
||||||
if (entre!="X" ||(entre !="x"))
|
|
||||||
{
|
|
||||||
return (true)
|
|
||||||
}
|
|
||||||
alert("You have entered an invalid email address!")
|
|
||||||
return (false)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
function rejoindrepartie(){
|
|
||||||
localStorage.setItem("nomJoueur", "J2");
|
|
||||||
}
|
|
||||||
|
|
||||||
function Tourdequi(joueur){
|
|
||||||
if(tab j1 + tabj2 .lenght %2==0){
|
|
||||||
return J1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return J2;
|
|
||||||
}
|
|
||||||
|
|
||||||
function finirpartie(){
|
|
||||||
localStorage.removeItem("nomJoueur");
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem("lastname", "Smith");
|
|
||||||
// Retrieve
|
|
||||||
document.getElementById("result").innerHTML = localStorage.getItem("lastname"); */
|
|
Binary file not shown.
@ -1,18 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head lang="fr">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
||||||
<title>Morpion</title>
|
|
||||||
<link rel="stylesheet" href="css.css">
|
|
||||||
<script type="text/javascript" src="js.js"></script>
|
|
||||||
</head>
|
|
||||||
<body onload="sdf()">
|
|
||||||
<h1><button onclick="creerPartie()">Créer partie</button></h1>
|
|
||||||
<h1><input type="b" name="sdf" placeholder="Mettre id de la partie"><button>Rejoindre</button></h1>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head lang="fr">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
||||||
<title>Morpion p2</title>
|
|
||||||
<link rel="stylesheet" href="css.css">
|
|
||||||
<script type="text/javascript" src="js.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body onload="affichage()">
|
|
||||||
<header>
|
|
||||||
<h1>Morpion</h1>
|
|
||||||
</header>
|
|
||||||
<div class="messages" id="messages">
|
|
||||||
<h2></h2>
|
|
||||||
</div>
|
|
||||||
<div class="instructions" id="instructions">
|
|
||||||
<p>Click in a box to play</p>
|
|
||||||
</div>
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<input></input required pattern="banane|cerise">
|
|
||||||
<input></input>
|
|
||||||
<input></input>
|
|
||||||
<br>
|
|
||||||
<input></input>
|
|
||||||
<input></input>
|
|
||||||
<input></input>
|
|
||||||
<br>
|
|
||||||
<input></input>
|
|
||||||
<input></input>
|
|
||||||
<input></input>
|
|
||||||
</div>
|
|
||||||
<button onclick="verifier(document.getElementById("in").value)">Valider</button>
|
|
||||||
|
|
||||||
|
|
||||||
<br> <button class="reset">Rénisitalisation</button>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="PYTHON_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
@ -1,12 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="ignoredIdentifiers">
|
|
||||||
<list>
|
|
||||||
<option value="main.helloHandler.*" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
|
||||||
</project>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/ServerPyt.iml" filepath="$PROJECT_DIR$/.idea/ServerPyt.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,140 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="BranchesTreeState">
|
|
||||||
<expand>
|
|
||||||
<path>
|
|
||||||
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
|
||||||
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
|
|
||||||
</path>
|
|
||||||
</expand>
|
|
||||||
<select />
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="28254644-08db-40a1-8497-05ce7fa43f93" name="Default Changelist" comment="" />
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="Git.Settings">
|
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectId" id="1kKwlpoG7vbAj2OMN8ReQMzKG2s" />
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">
|
|
||||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
||||||
<property name="restartRequiresConfirmation" value="false" />
|
|
||||||
</component>
|
|
||||||
<component name="RunManager" selected="Python.server">
|
|
||||||
<configuration name="client" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="ServerPyt" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/client.py" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
||||||
<option name="EMULATE_TERMINAL" value="false" />
|
|
||||||
<option name="MODULE_MODE" value="false" />
|
|
||||||
<option name="REDIRECT_INPUT" value="false" />
|
|
||||||
<option name="INPUT_FILE" value="" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<configuration name="server" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="ServerPyt" />
|
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
|
||||||
<option name="PARENT_ENVS" value="true" />
|
|
||||||
<envs>
|
|
||||||
<env name="PYTHONUNBUFFERED" value="1" />
|
|
||||||
</envs>
|
|
||||||
<option name="SDK_HOME" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
||||||
<option name="IS_MODULE_SDK" value="true" />
|
|
||||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
||||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
||||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/server.py" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
|
||||||
<option name="EMULATE_TERMINAL" value="false" />
|
|
||||||
<option name="MODULE_MODE" value="false" />
|
|
||||||
<option name="REDIRECT_INPUT" value="false" />
|
|
||||||
<option name="INPUT_FILE" value="" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
<recent_temporary>
|
|
||||||
<list>
|
|
||||||
<item itemvalue="Python.server" />
|
|
||||||
<item itemvalue="Python.client" />
|
|
||||||
</list>
|
|
||||||
</recent_temporary>
|
|
||||||
</component>
|
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="28254644-08db-40a1-8497-05ce7fa43f93" name="Default Changelist" comment="" />
|
|
||||||
<created>1605462744659</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1605462744659</updated>
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
|
||||||
<option name="TAB_STATES">
|
|
||||||
<map>
|
|
||||||
<entry key="MAIN">
|
|
||||||
<value>
|
|
||||||
<State />
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="oldMeFiltersMigrated" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="WindowStateProjectService">
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.bottom" timestamp="1605469519241">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1605469519241" />
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.center" timestamp="1605469519241">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1605469519241" />
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.left" timestamp="1605469519241">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1605469519241" />
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.right" timestamp="1605469519241">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="281" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1605469519241" />
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.bottom" timestamp="1605463596920">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1605463596920" />
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.center" timestamp="1605463596920">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1605463596920" />
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.left" timestamp="1605463596920">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1605463596920" />
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.right" timestamp="1605463596920">
|
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
|
||||||
</state>
|
|
||||||
<state width="1899" height="348" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1605463596920" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,40 +0,0 @@
|
|||||||
import socket
|
|
||||||
import threading
|
|
||||||
|
|
||||||
class Client:
|
|
||||||
def __init__(self):
|
|
||||||
self.create_connection()
|
|
||||||
|
|
||||||
def create_connection(self):
|
|
||||||
self.s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
try:
|
|
||||||
host = input("Entrez l'adresse IP de l'Host : ")
|
|
||||||
port = int(input("Entrez le port : "))
|
|
||||||
self.s.connect((host,port))
|
|
||||||
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
print("Impossible de se connecter au serveur")
|
|
||||||
|
|
||||||
self.username = input('Entrez votre pseudo : ')
|
|
||||||
self.s.send(self.username.encode())
|
|
||||||
|
|
||||||
message_handler = threading.Thread(target=self.handle_messages,args=())
|
|
||||||
message_handler.start()
|
|
||||||
|
|
||||||
input_handler = threading.Thread(target=self.input_handler,args=())
|
|
||||||
input_handler.start()
|
|
||||||
|
|
||||||
def handle_messages(self):
|
|
||||||
while 1:
|
|
||||||
print(self.s.recv(1204).decode())
|
|
||||||
print("")
|
|
||||||
|
|
||||||
def input_handler(self):
|
|
||||||
while 1:
|
|
||||||
print("Message : ",end='')
|
|
||||||
self.s.send((self.username+' - '+input()).encode())
|
|
||||||
|
|
||||||
client = Client()
|
|
@ -1,62 +0,0 @@
|
|||||||
import socket
|
|
||||||
import threading
|
|
||||||
|
|
||||||
class Server:
|
|
||||||
def __init__(self):
|
|
||||||
self.start_server()
|
|
||||||
|
|
||||||
def start_server(self):
|
|
||||||
self.s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
|
|
||||||
|
|
||||||
host = socket.gethostbyname(socket.gethostname())
|
|
||||||
port = int(input("Entrez le port sur lequel le serveur va être : "))
|
|
||||||
|
|
||||||
self.clients = []
|
|
||||||
|
|
||||||
self.s.bind((host,port))
|
|
||||||
self.s.listen(100)
|
|
||||||
|
|
||||||
print("Ip de l'host "+str(host))
|
|
||||||
print('Marche sur le port '+str(port))
|
|
||||||
|
|
||||||
self.username_lookup = {}
|
|
||||||
|
|
||||||
while True:
|
|
||||||
c, addr = self.s.accept()
|
|
||||||
|
|
||||||
username = c.recv(1024).decode()
|
|
||||||
|
|
||||||
print('Nouvelle connection : Pseudo '+str(username))
|
|
||||||
self.broadcast('Nouvelle personne à rejoind : Pseudo '+username)
|
|
||||||
|
|
||||||
self.username_lookup[c] = username
|
|
||||||
|
|
||||||
self.clients.append(c)
|
|
||||||
|
|
||||||
threading.Thread(target=self.handle_client,args=(c,addr,)).start()
|
|
||||||
|
|
||||||
def broadcast(self,msg):
|
|
||||||
for connection in self.clients:
|
|
||||||
connection.send(msg.encode())
|
|
||||||
|
|
||||||
def handle_client(self,c,addr):
|
|
||||||
while True:
|
|
||||||
try:
|
|
||||||
msg = c.recv(1024)
|
|
||||||
except:
|
|
||||||
c.shutdown(socket.SHUT_RDWR)
|
|
||||||
self.clients.remove(c)
|
|
||||||
|
|
||||||
print(str(self.username_lookup[c])+' est parti')
|
|
||||||
self.broadcast(str(self.username_lookup[c])+' a quite')
|
|
||||||
|
|
||||||
break
|
|
||||||
|
|
||||||
if msg.decode() != '':
|
|
||||||
print(str(msg.decode()))
|
|
||||||
for connection in self.clients:
|
|
||||||
if connection != c:
|
|
||||||
connection.send(msg)
|
|
||||||
|
|
||||||
|
|
||||||
server = Server()
|
|
Loading…
Reference in new issue