Multiplayer Game Challenge Results
🎁 1st Place (tied): 3D Online MP Shooter by @JSer
🎁 1st Place (tied): Agar.io by @vedprad1
🎁 3rd Place: OneShot by @IbraheemRodrigues
Posts
Pinned
60
👋✨Introduce yourself 🎉😀
Hello everyone! Let's use this thread to get to know each other. Just say hi and a few words about who you are, maybe what are you building or learning with Repl.it. If you're not comfortable sharing anything then share something fun 😉
283
posted to Announcements by amasad (283) about 2 months ago
Pinned
11
Tutorial: Two Player 2048 w/ JS/Node/Express + Socket.io
Hey Everyone! I wrote a multiplayer 2048 game, converting the classic 2048, adding a Node.js server + Socket.io, so you can race with your friends in 2048! I've also written a guide below on how I was able to build this step-by-step for some inspiration :) Check out [the demo here](https://repl.it/@MikeShi42/competitive-2048-demo-final)! Fork the repl and share your fork’s link with a friend to play with them! ![competitive 2048 game gif](https://media.giphy.com/media/fQDbaH9kl4O0UWtc3Y/giphy.gif) # Guide Today we’re going to turn the classic 2048 game, into a competitive multiplayer game for you to race with your friends. The best part is that with repl.it, socket.io and the original open source 2048 code makes this really easy to do! You’ll want to have some experience with HTML/CSS/JS and Node.js to get started with this guide. # Getting Started [repl.it](https://repl.it) is a powerful and beginner friendly web-based IDE that allows you to kick off a programming environment in almost any language you’d ever want to try with a couple of clicks. It has insanely easy Node.js/Express project hosting which we’ll use for this multiplayer project! To start, we’re going to [fork off this starter project](https://repl.it/@MikeShi42/competitive-2048-starter), that’s simply the [2048 single player version](https://github.com/gabrielecirulli/2048) uploaded to repl.it with minimal changes. ![repl.it fork gif](https://media.giphy.com/media/fQuCU2FHuhGym3tuq5/giphy.gif) # Setting Up our Socket.io Server Now with our project set up and base files in place, we can start coding our Node.js server that will coordinate the moves between two players. We’ll be using [Socket.io](https://socket.io/) to let our clients and our server communicate in real time, without latency of HTTP requests and other complexities. Socket.io is a library that handles delivering messages back and forth between our client code (browser game) and our Node.js server via [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). In our game, it’ll allow our games to tell the server about moves we make, and the server to tell us about moves our opponents make, with only a few lines of code! ## Installing the Socket.io NPM Package We first want to install the socket.io package, we can do this via the package tool on the left side of your repl.it editor, and simply search “socket.io” and click the + icon. ![adding socket.io gif](https://media.giphy.com/media/SFL9z46BeHGaAuld6q/giphy.gif) ## Initializing Our Server Next we can go to our “index.js” file for our Node server and clear out the current content so we can start fresh! We’ll then want to import Express, Socket.io and HTTP server dependencies to be able to serve the front-end code we just uploaded into the “public” folder, and accept messages via Socket.io. ```javascript const express = require('express'); const socketio = require('socket.io'); const http = require('http'); const app = express(); const server = http.Server(app); const io = socketio(server); // Attach socket.io to our server app.use(express.static('public')); // Serve our static assets from /public server.listen(3000, () => console.log('server started')); ``` ## Handling Connections Next we’ll want to create an array to hold our users and assign them a player number when they connect to our server. Add this bit of code right after the server.listen line: ```javascript const connections = [null, null]; // Handle a socket connection request from web client io.on('connection', function (socket) { // Find an available player number let playerIndex = -1; for (var i in connections) { if (connections[i] === null) { playerIndex = i; } } // Tell the connecting client what player number they are socket.emit('player-number', playerIndex); // Ignore player 3 if (playerIndex == -1) return; connections[playerIndex] = socket; // Tell everyone else what player number just connected socket.broadcast.emit('player-connect', playerIndex); }); ``` `io.on(‘connection’, function...)` listens for new client connections, and handles each connection by calling the defined function. `socket.broadcast.emit` will send a message to all other clients connected to the server and `socket.emit` will send a message to only the current connected client. Now when a user connects, they’ll be given a player number (either 0, 1 or -1 if the game is full), and everyone else will know when a user has connected (so we know to start the game). ## Handling Moves Next, inside of our connection callback, we can handle when a user gives us a move, we should broadcast it to the other player. We can paste this bit of code right after the `socket.broadcast.emit` line from above. ```javascript socket.on('actuate', function (data) { const { grid, metadata } = data; // Get grid and metadata properties from client const move = { playerIndex, grid, metadata, }; // Emit the move to all other clients socket.broadcast.emit('move', move); }); ``` ## Handling Disconnects We don’t want a player that disconnects to “ghost” on our server as a real user. So we’ll also clear out that user’s socket handle when they disconnect. ```javascript socket.on('disconnect', function() { console.log(`Player ${playerIndex} Disconnected`); connections[playerIndex] = null; }); ``` We can simply add the above snippet below our ‘actuate’ message handler. Your `index.js` should now look like [this](https://gist.github.com/MikeShi42/13b11837c02ad20807d44cd40e8371e4). # Creating our Second (Remote) Game Board Now with the server stuff out of the way, we can focus on turning our single board 2048, into a multi-board 2048! ## Copy Pasta The first thing we’d need to do, is literally copy and paste a second board from our public/index.html document. We first wrap the `<div class="game-container">...</div>` element in another div like `<div id="player-one"><div class="game-container">...</div></div>`. We can duplicate that div and name it “player-two”. In the end, part of your index.html should look like this [gist](https://gist.github.com/MikeShi42/82c173656e539185d78711e53ce293fd). This way we have two boards, and we can address each by their class name as either player-one or player-two. # Sending Messages Over WebSocket Now that we have two game boards, we’ll want to be able to control them over websockets. ## Connecting the Sockets First we’ll want to start talking to our server via socket.io. We’ll want to include the socket.io library via a <script /> tag in `public/index.html`. Like so: ```html ... </div> <!-- Below is the script tag you need to add! --> <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js"></script> <script src="js/utils/keyboard_input_manager.js"></script> ... ``` That way we’ll have the socket.io library loaded before any of our game code, any avoid any errors referencing the socket library in our code. Next we’ll have to actually initialize the connection in `public/js/application_manager.js`. ```javascript window.requestAnimationFrame(function () { var socket = io.connect(window.location.origin); ... ``` Here we’re telling the socket.io to connect to our server, and the server is located at `window.location.origin`. This allows it to connect to whatever URL is hosting the page, so if you fork the repl.it, it’ll automatically point to your fork’s URL, instead of a hardcoded URL. ## Modifying Game Manager Now we’ll want to modify the game manager so that it can handle remote players and handle local players. In `public/js/game_manager.js` we can add two new arguments in the front of the constructor called `remotePlayer` and `socket`. `remotePlayer` will be a boolean representing if this GameManager is managing a remote player, or the local player. `socket` will be the socket.io connection we just initialized in the above section. The first couple lines of `public/js/game_manager.js` should look like this: ```javascript class GameManager { constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager(); ... ``` Before the end of the constructor, we’ll want to “save” the `socket` and `remotePlayer` values as local properties of the object. We’re also going to pass in `remotePlayer` as an argument to `Actuator`, which we’ll use later to decide which HTML Grid we should update (depending if it’s for player 1 or player 2). ```javascript constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { this.size = size; // Size of the grid this.inputManager = new InputManager(); this.storageManager = new StorageManager; // Change Actuator to take in remotePlayer as an argument! this.actuator = new Actuator(remotePlayer); this.startTiles = 2; ... this.inputManager.on("keepPlaying", this.keepPlaying.bind(this)); // Add these two lines this.remotePlayer = remotePlayer; this.socket = socket; this.setup(); } ``` ## Sending Moves over Websocket Now we want that every time we make a move on our local board, we should tell the server about it, and the server will tell player 2 about the move we just made. First we want to create a function in our GameManager that will handle sending remote moves. We can simply insert this below our GameManager constructor we were writing in the previous section. ```javascript sendRemoteMove(grid, metadata) { if (!this.remotePlayer) { this.socket.emit('actuate', { grid: grid, metadata: metadata }); } } ``` This function takes in a grid: the current board state, and metadata: the score, win/loss, etc. of the game currently. If the current GameManager is not the remote player (so it’s the local player), then we should send the move over. We’ll emit a message with the event name of “actuate”. Notice how this event name matches the one we’re listening for on the server in `/index.js`. The second argument specifies the message payload of `grid` and `metadata`. Now we want to call our function from `GameManager.actuate`. Notice the function already calls this.actuator.actuate which takes a grid and some metadata object. We can similarly call our `sendRemoteMove` function right after it. The `actuate` function should look like the below: ```javascript // Sends the updated grid to the actuator actuate() { if (this.storageManager.getBestScore() < this.score) { this.storageManager.setBestScore(this.score); } // Clear the state when the game is over (game over only, not win) if (this.over) { this.storageManager.clearGameState(); } else { this.storageManager.setGameState(this.serialize()); } const grid = this.grid; const metadata = { score: this.score, over: this.over, won: this.won, bestScore: this.storageManager.getBestScore(), terminated: this.isGameTerminated() }; this.actuator.actuate(grid, metadata); this.sendRemoteMove(grid, metadata); // Call our sendRemoteMove function! } ``` ## Handling Remote Moves over Websocket We’ll also want to be able to take moves from player 2, and replay them on our local player 2 board to see what our competitor is doing. First we want to define a function that can take a remote move and change the board to make the move. We’ll define the function right after `sendRemoteMove` that we defined before. ```javascript handleRemoteMove(data) { const grid = data.grid; const metadata = data.metadata; this.actuator.actuate(grid, metadata); } ``` Next we’ll want to set up an event handler that will listen to when the remote player makes a move, but only if the current GameManager is handling the remote board. We’ll want to add a new if switch to our constructor function ```javascript constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { ... // Add these two lines this.remotePlayer = remotePlayer; this.socket = socket; // Add this new if statement if (this.remotePlayer) { this.socket.on('move', this.handleRemoteMove.bind(this)); } this.setup(); } ``` If you’re testing the game now, you might notice that sometimes one player can sometimes update the other player’s board, but things aren’t consistent and everything is a bit buggy. We’ll be fixing that up in the following steps! ## Updating Player 2’s HTML Board Now that we can get moves over the socket connection, we want to update the correct board so that we can see what our opponent is doing. We’ll want to modify `public/js/html_actuator.js`, specify the HTMLActuator constructor so that it’ll target the right game board depending if it’s the local player or remote player. The constructor should look like this: ```javascript class HTMLActuator { constructor(remotePlayer) { if (remotePlayer) { this.tileContainer = document.querySelector("#player-two .tile-container"); this.messageContainer = document.querySelector("#player-two .game-message"); } else { this.tileContainer = document.querySelector("#player-one .tile-container"); this.messageContainer = document.querySelector("#player-one .game-message"); } this.scoreContainer = document.querySelector(".score-container"); this.bestContainer = document.querySelector(".best-container"); this.score = 0; this.remotePlayer = remotePlayer; } ``` We’re swapping out the old querySelector for tile container and game messages for one that targets specifically player one or player two’s game board. Additionally, we’re also going to save the remotePlayer as a local property so we can access it later. ## Duplicating Game Manager Next we can create another GameManager for player 2 in `public/js/application.js`, pass in the new arguments that we’ve defined for GameManager, and save the GameManager instances for later. We’ll create two variables called “remoteGame” and “localGame” to store the two GameManager instances we’ll create. After everything, the application.js file should look something like this: ```javascript let remoteGame = null; let localGame = null; // Wait till the browser is ready to render the game (avoids glitches) window.requestAnimationFrame(function () { const socket = io.connect(window.location.origin); remoteGame = new GameManager(socket, true, 4, KeyboardInputManager, HTMLActuator, LocalStorageManager); localGame = new GameManager(socket, false, 4, KeyboardInputManager, HTMLActuator, LocalStorageManager); }); ``` We’ve changed the GameManager to take the `socket` we’ve defined earlier as well as a bool value representing if the GameManager is responsible for the remote board or local board. With that in place, we’re now actually pretty close to having two boards being able to interact with each other. If you’re testing it, you might notice that by opening two different tabs of 2048, that they’re able to talk to each other, but also seem to be weirdly linked together. We’ll fix that right now! ## Don’t Listen To My Keys An issue right now is that both GameManager (both remote and local) are listening to your keystrokes. Which leads to really weird behavior. Let’s make it so that only the local GameManager listens to keystrokes while the remote one only actuates on a socket message. In our GameManager constructor we want to only listen to keystrokes if it’s not the remote player. Additionally, we’ll move the listener binding code into the `setup` function, which will help us control when the user can start issuing inputs into the game (which will be helpful later). GameManager Before: ```javascript class GameManager { constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { ... this.startTiles = 2; // We’ll be deleting these 3 lines this.inputManager.on("move", this.move.bind(this)); this.inputManager.on("restart", this.restart.bind(this)); this.inputManager.on("keepPlaying", this.keepPlaying.bind(this)); this.remotePlayer = remotePlayer; ... ``` After: ```javascript class GameManager { constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { ... this.startTiles = 2; this.remotePlayer = remotePlayer; ... ``` Setup Before: ```javascript setup() { var previousState = this.storageManager.getGameState(); ... } ``` Setup After: ```javascript setup() { if (!this.remotePlayer) { this.inputManager.on("move", this.move.bind(this)); this.inputManager.on("restart", this.restart.bind(this)); this.inputManager.on("keepPlaying", this.keepPlaying.bind(this)); } var previousState = this.storageManager.getGameState(); ... ``` This makes sure that we’re only listening to moves when we’re the local player, and only after `setup` is called. ## Testing! With that, the basic game should be done! You can open two tabs to test out how your moves can be seen by both tabs. However, there’s still a lot of rough edges that need to be ironed out. You may have noticed that the board starts from the last saved state, and you never know if your friend has connected yet and whatnot. We’ll tackle all of those issues in the next section! # Game Polish ## Removing Locally Saved State We don’t want to start the game from whatever we last left off at, as that would gives us an unfair advantage! Instead we’ll disable the ability to restore the game state from local storage. We’ll simply delete the restoring mechanism in `GameManager.setup` in `public/js/game_manager.js`. Additionally, we’ll only put down starting tiles if it’s the local game, so we don’t populate the remote board with starting tiles. In the end our setup function should look like this: ```javascript setup() { if (!this.remotePlayer) { this.inputManager.on("move", this.move.bind(this)); this.inputManager.on("restart", this.restart.bind(this)); this.inputManager.on("keepPlaying", this.keepPlaying.bind(this)); } this.grid = new Grid(this.size); this.score = 0; this.over = false; this.won = false; this.keepPlaying = false; if (!this.remotePlayer) { // Add the initial tiles this.addStartTiles(); } // Update the actuator this.actuate(); } ``` ## Game Starting Message We want to know when player 2 has connected, as well as provide a countdown so that there is a delay between when player 2 has connected, and when the game will start. We’ll first want to add the HTML elements to inform the user that they’re waiting for the next player and a countdown timer message as well. We’ll want to place these elements above the player board divs, that way it’s easily visible when the game loads. ```html … <div class="above-game"> <p class="game-intro">Join the numbers and get to the <strong>2048 tile!</strong></p> <a class="restart-button">New Game</a> </div> <!-- Add these two divs --> <div class="message-container waiting-message" style="display: none;"> Waiting for Player 2... </div> <div class="message-container countdown-message" style="display: none;"> Game starting in <span class="countdown-number"></span>... </div> <div id="player-one"> <div class="game-container"> <div class="game-message"> ... ``` Additionally in `public/style/main.css`, we can define some styling so that our messages are easily visible. ```css @import url(fonts/clear-sans.css); /* Styling to make the message containers look nice */ .message-container { background: #8e7967; color: white; text-align: center; padding: 1em; margin: 1em; font-weight: bold; font-size: 1.2em; } html, body { ... ``` Next we’ll want to define some helper methods to hide/display the messages, as well as display the correct time for the countdown. We should do this in `public/js/application.js`. You can simply define these methods at the top of the script. ```javascript function waitingPlayerTwo(show) { const messageContainer = document.querySelector('.waiting-message'); messageContainer.style.display = show ? 'block' : 'none'; } function countdownMessage(show, number) { const messageContainer = document.querySelector('.countdown-message'); const countdownNumber = document.querySelector('.countdown-number'); messageContainer.style.display = show ? 'block' : 'none'; countdownNumber.textContent = number; } ``` ## Kicking Off the Game Next we’ll want to define a method that actually kicks off the game. In this case, we’ll also have it do a countdown timer before starting the game. We can similarly just define this at the top of `public/js/application.js` ```javascript function startGame() { let seconds = 4; // Number of seconds + 1 to wait // Start a countdown timer const intervalId = setInterval(function() { // Subtract the number of seconds left and update UI seconds--; countdownMessage(true, seconds); if (seconds == 0) { // It's time to start the game! clearInterval(intervalId); // Stop the countdown countdownMessage(false, 0); // Hide the countdown message if (remoteGame != null && localGame != null) { localGame.restart(); // A game already exists, lets just reset the game. } else { // Start the game managers remoteGame.setup(); localGame.setup(); } } }, 1000); } ``` The function may seem a bit complicated at first but breaks down to be fairly simple. We first start with defining a function that is called every second via: ```javascript const intervalId = setInterval(function() { ... }, 1000); ``` Next inside the function, we’ll want to subtract from the number of seconds we want to count down from, and then update the UI using our `countdownMessage` functions. ```javascript seconds--; countdownMessage(true, seconds); ``` When the countdown has hit 0 seconds, we’ll want to stop the function from executing again via `clearInterval`, hide the countdown message, and then start the games. Next we’ll want to sync up the waiting and countdown message with when users connect. In our `requestAnimationFrame` callback where we’re currently creating the game managers, we can listen to socket events to determine when we’ve connected, and when the opponent has connected to the server. We can put this at the bottom of the `requestAnimationFrame` callback. ```javascript window.requestAnimationFrame(function () { ... localGame = new GameManager(socket, false, 4, KeyboardInputManager, HTMLActuator, LocalStorageManager); // Add this socket lisetner socket.on('player-number', function (playerNumber) { if (playerNumber == 1) { waitingPlayerTwo(true); // Show waiting message // On 2nd player connect, start the game socket.on('player-connect', function() { waitingPlayerTwo(false); // Hide waiting message startGame(); }); } else { // Immediately start the game if we're player two startGame(); } }); ``` If we’re player 1, we’ll display that we’re now waiting for player two to the user. When we’ve detected that another player has connected, we’ll hide the waiting message and start the game countdown. If we’re player two, we’ll just immediately start the game countdown after we’ve connected to the server. Now there only leaves one last thing to do, is to not start the game immediately when we create a new GameManager. In our `public/js/game_manager.js`, we’ll simply remove `this.setup();` from the constructor. That way we won’t call it at instantiation, but instead only when we explicitly call it at `startGame` that we defined in application.js. Our constructor should look like this: ```javascript class GameManager { constructor(socket, remotePlayer, size, InputManager, Actuator, StorageManager) { ... // Add this new if statement if (this.remotePlayer) { this.socket.on('move', this.handleRemoteMove.bind(this)); } // No setup! } ``` If all has gone well, your project should look similar to [this repl](https://repl.it/@MikeShi42/competitive-2048-tutorial-final). # Improve The Game! This ends the basics of creating a multiplayer 2048 game! The [final demo](https://repl.it/@MikeShi42/competitive-2048-demo-final) version has a couple of tweaks that you can check out the source code to see how I’ve done it like: Side by Side Game Boards Opponent Won Message Eliminating Extraneous Buttons Set Game Goal (Instead of winning @ 2048, can be easier or harder) Game Full Message ## Even More! There’s space for even more improvement such as real-time chat using socket.io to chat with your opponent, a timer to time-cap the game, or mechanisms where your success impedes your opponent’s ability to succeed well (ex. frozen tiles). There’s a lot more creative ways to take the game that would be exciting to see! # Fin Let me know if any of the steps were confusing or unclear :) I'll do my best to help!
2
posted to Announcements by MikeShi42 (21) 10 days ago
Pinned
34
Rules for Posting - Read me!
Some rules and guidelines to keep in mind as you share your great work on our boards: 1 - Be kind and courteous to others 2 - Make sure that any feedback you provide is constructive. 3 - Outside links are allowed, but you must provide the source. Ideally, things that you post will have been created on Repl.it. 4 - Avoid posting overly promotional material - the focus is, and always will be, a programming, learning, and collaborative community. :) 5 - Don't spam / keep things SFW (Safe For Work). We may revoke your access to these boards if you are found to be in violation of any of these rules. Feel free to ask clarifying questions. Last updated 7/10/18 12:09 PST
20
posted to Share by timmy_i_chen (245) about 2 months ago
Pinned
52
July Competition: Create Multiplayer Games
We're bringing back competitions, and this one is all about Multiplayer Games! Previously we shared [Hop Fighter](https://hop-fighter--kaldisberzins.repl.co/) by [@kaldisberzins](https://repl.it/@kaldisberzins/) as a shining example. He kindly created an example of how to create a similar game using Node.js and websockets. Feel free to check out and fork his sample game [here](https://repl.it/@kaldisberzins/Multiplayer-Game-Example). Your game can be in any language! **How To Submit** Submit by posting your repl link to this board: https://repl.it/talk/challenge **How To Win** Get the most votes by the end of the competition: **Aug 14, 2018**. **Prizes** First Place: $100 Amazon Gift Card Second Place: $50 Amazon Gift Card Third Place: $20 Amazon Gift Card Team Favorite (picked by Repl.it team): $20 Amazon Gift Card. Additionally, winners will be featured in our newsletter! **Additional Rules** * Your work must be your own - you cannot plagiarize * Vote manipulation in any form will get you disqualified * Don't ask for votes outside of your submission
49
posted to Challenge by timmy_i_chen (245) about 1 month ago
7
PIANO!!
UMM...IT'S A PIANO AND YEAH THAT EVEN MADE WITHOUT USING AUDIO FILES ☺
0
posted to Share by spybrave (128) about 11 hours ago
1
DRAW IT OUT
Have fn drawing pictures with different colors.
1
posted to Share by alexpark747 (0) about 11 hours ago
1
A quick question to the repl.it devs..
So while reading the docs, I remembered a certain function called dir(), which creates a list of all the functions/variables in a certain module. So, I did `print(dir(replit())` which printed `['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'clear', 'init', 'send_msg']` so just as a random question, what is 'send_msg'? I'm just curious about this. Thanks! EDIT: Ok after looking at @LumpyWiggles bash shell thing I tried to mess around so I tried to look for replit.py in /usr/local/lib/python3.6 but nothing came up... I would try to cat the file but I couldn't find it... well... Anyways I think I've been trying to mess around for too long so I guess I'm done here
1
posted to Ask by ash15khng (4) about 16 hours ago
2
What else could I do in python?
I am a beginner in python and I do not know what to do next. I have already done a clock, calculator, random number generator, a simple coding language and a tutorial on how to use that programming language. Does anyone have any ideas?
4
posted to Ask by HarveyH (14) 1 day ago
3
Repl Talk Discord Bot
This bot automatically puts things posted in repl talk into the [Repl.it Discord](https://discord.gg/XadDsju).
2
posted to Share by mat1 (57) 2 days ago
2
Flask template problem
I have a code sample from repl.it https://repl.it/@Utku_CanCan/flask-boilerplate-1 That uses render_template. I forked it and ran it without any changes: https://repl.it/@mscohen/flask-boilerplate-2 It doesn't work, and raises an error: template not found. Any ideas?
2
posted to Ask by mscohen (1) 2 days ago
3
Get SHELL Access To A repl.it Container
This is a ver simple script to get SHELL access on a repl.it container, basically its a virtual machine that repl.it complies & runs your code in, so i basically just exploited this feature to get shell access to the terminal. Note : I am still adding more exploits.
1
posted to Share by zphantom (4) 3 days ago
1
Python: Stuck in read-only editor
I seem to have somehow put the editor for my Python 3 REPL into read-only mode, as I am now greeted by the message "Cannot edit in read-only mode" when trying to do anything. I'm guessing there's a simple way to change it back, but I can't seem to find it. Any ideas?
8
posted to Ask by blanton1 (0) 4 days ago
1
Tic-Tac-Toe
A nice tic tac toe game.
2
posted to Share by Wrong (0) 2 days ago
9
Tic Tac Toe Game - With explainations
It is a simple tic tac toe game!
1
posted to Challenge by Nesky (8) 4 days ago
0
-4
Hi ... I am relatively new here... I've been trying to export this since yesterday but it seems like it is not working ?
3
posted to Ask by FedericoGiannel (0) 4 days ago
1
Best Hangman Game?
PLay at your own risk
1
posted to Share by Wrong (0) 2 days ago
1
Want to learn more - but how?
I recently became interested in coding. I want to learn it to get better at it. I took some courses on Lynda.com for some of the fundamentals. But having a hard time retaining it. My second option was to take some classes at the local community college and potential get an Associates in it. I'm not sure if that's the best path, but I do know I learn better in a classroom/hands-on environment. Do you guys have any suggestions for a beginner with this type of learning style (but ultimately want to code for personal and professional gain)?
2
posted to Ask by damcneal (0) 3 days ago
2
User input reprinting to console in C++
Hi, I'm working on a C++ program and one of the parts of it takes user input. The user is presented with a menu and is then asked to choose a number and hit enter. But for some reason, the program is reprinting the input to the console as well as the newline ("^J") character. To get the input, i use "std::cin" and the "getline" function and the issue occurs with both of these. Also, the issue is happening across all my C++ programs in repl.it, even new ones. I've attached a picture for reference. I hope I included sufficient details and thank you in advance! ! https://drive.google.com/file/d/1U1m1nP0zXxAFYKN5xEBRJ4JX5W6BDzIU/view?usp=sharing
6
posted to Ask by stucko09 (1) 5 days ago
5
Hello
Hello
7
posted to Share by Awesomeman78910 (8) 6 days ago
1
ATM
There is something wrong with my code here. can someone please correct it for me?
4
posted to Ask by fariha_hime (0) 5 days ago
5
COOL
it's just saying I AM COOL this is my first repl (:
6
posted to Share by Awesomeman78910 (8) 6 days ago
12
Two Player 2048: Race w/ Friends!
Fork the repl, and share the link with a friend to race in 2048, side-by-side! ![competitive 2048 game gif](https://media.giphy.com/media/fQDbaH9kl4O0UWtc3Y/giphy.gif) If you're intereseted in learning how it's built, check out the guide I shared: https://repl.it/talk/announcements/Multiplayer-2048-Race-with-your-friends/5469
4
posted to Challenge by MikeShi42 (21) 7 days ago
6
A SIMPLE CHESS BOARD
Looking forward to make it into a game :)But that day is far away :(
3
posted to Share by spybrave (128) 6 days ago
24
Hangman
I coded this game in Python. Follow the directions in the program. Please vote if you like it!
5
posted to Challenge by AnushkaPoddar (23) 9 days ago
1
ruby class and instance
created a class in ruby : class Kitty made an instance : fuzz = Kitty.new was told i need to authenticate it. why? what? where?
1
posted to Ask by firao (0) 3 days ago
1
Java and C++ REPL ^J
On all of my Java and C++ REPLs, whenever I give input, below the input, is what I inputted, followed by ^J. (Example: what's your name? Zwxwvut, below it would be Zwxwvut^J.) I have no clue why this happens, it happens only on my Java and C++ REPLs, and I don't know if this happens to any other Java REPLs... But if any of you have a reason/answer it would be GREATLY appreciated.
3
posted to Ask by Zwxwvut (5) 5 days ago
1
Coding challenge margin problem
Hi there. Iv'e created web page and now I need to ad margins and borders to center the page . I went through few tutorials but got completely stuck . Help please! Here is my code <!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; margin left:200; } </style> </head> <body> <center><table> <tr> <th><H1>My Recipe Website</H1></th> </tr> </table></center> <table> <tr> <th><iframe width="745" height="315" src="https://www.youtube.com/embed/bjmYkPkjnVo" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> <!--lists--> <H1>Ingredients</H1> <ol> <li>1 pound dry spaghetti</li> <li> salt and black pepper to taste</li> <li> 6 colves garlic, sliced thin</li> <li> 1/2 cup olive oil</li> <li> 1/4 teasspoonred pepper flakes, or to taste</li> <li> 1/4 cup finely chopped Italian parsley</li> <li> 1 cup finely grated Parmesan cheese</li> <li> 1 tablespoon of butter </li> </ol> </th> <th><iframe width="745" height="315" src="https://www.youtube.com/embed/sAhUTzTJNaE" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe> <!--second list --> <H1>Ingredients</H1> <ol> <li> 500 gram of pasta (cooked as per packet directions</li> <li> 30g of Butter</li> <li> 4 Cloves of Minced Garlic (about 3-4 teaspoons)</li> <li> 1 1/2 Cups of Cream (about 400ml)</li> <li> Salt and Pepper</li> <li> 1/2 Cup of Freshly Grated Parmesan Cheese</li> <li> 2 Teaspoons of Freshly Chopped Parsley (plus extrea to garnish)</li> </ol> </table> </body> </html>
2
posted to Ask by AnestIwata84 (0) 5 days ago
1
VioletTechnologicalBytes
sss
1
posted to Share by GiovannyHidalgo (0) 3 days ago
1
TurquoiseGrandWorker
Awesome meter
3
posted to Share by Awesomeman78910 (8) 6 days ago
2
Alphamorse
This is my own method of ciphering text. It turns text to morse code than turns it back into text where every letter is a dot or a dash.
1
posted to Share by AdrianTang (5) 5 days ago
Load more