Golf it! is a game designed to let you show off your code-fu by solving problems

Overview

Issues


Logo

Golf it!

Golf it! is a game designed to let you show off your code-fu by solving problems
in the least number of characters
Explore the docs »

View Demo · Report Bug · Request Feature

🎯 Table of Contents

📖 About The Project

One of our teammates loves to solve codegolf questions. We thought it would be a good idea to implement this as a one on one competition, where two players can compete live to write the shortest snippet of code to solve a question.

Code Golf refers to attempting to solve a problem using the least amount of characters possible i.e. to have the smallest source code. The term is derived from the sport golf where the player’s goal is to hit their ball in the hole using the least number of shots possible. In Code Golf the developer that solves the problem (usually writing a function) using the fewest number characters possible wins.

⚙️ How we built it

The backend was built using NodeJS and Typescript. We used expressJS to implement all the routes required for submitting code. The backend uses an npm library called code-executor which was built in the past by one of our teammates, to execute code against test cases in isolated Docker containers. To implement real-time communication when a head-to-head game started, we used socket.io to connect both the players in the same room. We used firestore as a database.

The frontend was built using React and Bootstrap. We used socket.io-client to interact with the socket server, and axios to interact with the express backend. To display the code editor on the website with multiple themes and syntax support for languages, we used a library called react-ace.

🚀 What's next for Golf-it!

We have many features planned for golf-it in the future:

  • Global leaderboards across the website, for players who regularly win more and more head-to-head games to showcase their skills.
  • User accounts (registering and logging in)
  • The ability for users to submit their own questions, and people to vote for questions they found interesting.
  • Picking avatars for your own profile
  • Having live competitions with even more people, instead of just head-to-head ones.

Built With

Backend Frontend
Typescript Javascript
express axios
firebase React
code-executor react-redux
socket.io socket.io-client
joi react-router-dom
redis react-ace

✈️ Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • yarn
npm install -g yarn

Installation

  1. Clone the repo
git clone https://github.com/ashikka/golf-it.git
  1. Install yarn packages
yarn
  1. Add necessary environment variables to the project using:
{
        echo 'API_KEY='
        echo 'AUTH_DOMAIN='
        echo 'PROJECT_ID='
        echo 'STORAGE_BUCKET='
        echo 'MESSAGING_SENDER_ID='
        echo 'APP_ID='

} >> .env

🔧 Usage

Start the project locally by following these steps.

  1. Run a Redis broker on your system
docker run -p6379:6379 redis
  1. Start the worker which is going to interact with the library code-executor.
cd backend

ts-node worker.ts
  1. Start the backend using:
yarn run dev
  1. Start the frontend using:
cd frontend

yarn start

🚩 Routes

The backend of the project supports the following routes:

1. Code submission

POST /code/submission/:questionName
Parameter Type Description
params string questionName
body string language
body string code
body Date submitTime

2. Create new room

POST /room/create
Parameter Type Description
body string clientId
body number payload

3. Get room

GET /room/:roomId
Parameter Type Description
params string roomId

🗺️ Roadmap

See the open issues for a list of proposed features (and known issues).

🦾 Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat: Add some AmazingFeature')
  4. Push to the Branch (git push -u origin feature/AmazingFeature)
  5. Open a Pull Request

You are requested to follow the contribution guidelines specified in CONTRIBUTING.md while contributing to the project 😄 .

📄 License

Distributed under the MIT License. See LICENSE for more information.

You might also like...

🎮 Excalibur is a free game engine written in TypeScript for making 2D games in HTML5 canvas

🎮 Excalibur is a free game engine written in TypeScript for making 2D games in HTML5 canvas

🎮 An easy to use 2D HTML5 game engine written in TypeScript

Nov 25, 2022

Pig is a simple two player dice game.

Pig is a simple two player dice game.

Pig game Pig is a simple two player dice game. Play here: formidablae.github.io/pig_game or formaidablae-pig-game.netlify.app Each turn, a player repe

Oct 5, 2022

Quizpetitive - A quiz game to learn new knowledge and terms in the field of project management.

Quizpetitive - A quiz game to learn new knowledge and terms in the field of project management.

Quizpetitive A quiz game to learn new knowledge and terms in the field of project management. The key element to the success of this project was the c

May 16, 2022

Bitburner Game

Bitburner Bitburner is a programming-based incremental game that revolves around hacking and cyberpunk themes. The game can be played at https://danie

Nov 26, 2022

A clone of the popular Wordle game.

Wordle Clone How to play locally: yarn install

Jan 9, 2022

A clone of the popular game Wordle made using React, Typescript, and Tailwind

Wordle Clone Go play the real Wordle here Read the story behind it here Try a demo of this clone project here Inspiration: This game is an open source

Nov 24, 2022

🎩 2048 game is cloned with ReactJS, CSS3.

2048-react This is a clone of 2048 implemented using React. It's running live here. The game logic is implemented in ./src/components/mainBoard.jsx. I

Jul 31, 2022

A tiny game to practice AoE building shortcuts.

Aegis A tiny game to practice Age of Empires IV building shortcuts. Using ⚛️ Create-React-App and 🐻 Zustand. License With the exception of all visual

Oct 20, 2022

Snake game using pure HTML, CSS and JavaScript with GameBoy look and feel using Nano editor

Snake game using pure HTML, CSS and JavaScript with GameBoy look and feel using Nano editor

Snake game using pure HTML, CSS and JavaScript with GameBoy look and feel using Nano editor. 100% commented code in Portuguese

Jul 2, 2022
Comments
  • [WIP] Rooms

    [WIP] Rooms

    Added backend functionality to

    • create a room with parameters
    • join said room
    • rejoin same room if disconnected
    • get room info
    • relay user typing input to others in same room
    opened by zrthxn 1
Owner
Ashikka Gupta
Vice Chair @csivitu | Web Developer
Ashikka Gupta
Eva.js is a front-end game engine specifically for creating interactive game projects.

High-performance: Eva.js is powered by efficient runtime and rendering pipeline (Pixi.JS) which makes it possible to unleash the full potential of your device.

EVA 1.6k Nov 22, 2022
WordleGameCB - a game inspired by the Wordle word game developed by Josh Wardle

Technologies WordleGameCB WordleGameCB is a game inspired by the Wordle word game developed by Josh Wardle. This application was developed with the ai

@Encoding 4 Feb 20, 2022
A simple app to show NBA games and scores/details.

NBA Remix A simple app to show NBA games and scores/details. Deployment After having run the create-remix command and selected "Vercel" as a deploymen

Willian Justen 194 Nov 2, 2022
A Wordle-like game where you have to guess the unsigned 8-bit binary number

Bytle A Wordle-like game where you have to guess the unsigned 8-bit binary number! Game coded in 2h 14m 50.570s, but it's not like I'm counting how lo

James Livesey 16 Jun 30, 2022
Provides 5 keywords with which to narrow down your wordle game. I ruin nice things.

Widdle?? I hate fun so I wrote a script that ruins Wordle. This script can be used to find a Widdle, a set of five words that cover nearly all letters

Tess Myers 3 Mar 12, 2022
The extension to help you when you badly don't want to mess up your wordle streak

Your last resort in woordle to maintain your woordle win streak

Sreecharan 2 Feb 3, 2022
Created by Hashlips! In this repository, Hashlips and ScrawnyViking teach you how to create your unique randomly generated NFTs and launch them on to a free Github Domain where people can buy your NFTs from

Thank You HashLips ?? Upgraded and Articulated by ScrawnyViking aka TWECryptoDev All the code in these repos was created and explained by HashLips - P

TomorrowWontExist 15 Oct 23, 2022
A lightweight 3D game engine for the web.

A lightweight 3D game engine for the web. Built with three.js and cannon-es.

null 656 Nov 17, 2022
🏎 Open source racing game developed by everyone willing

?? Open source racing game developed by everyone willing

Poimandres 2k Nov 17, 2022
LittleJS Logo LittleJS - The Tiny JavaScript Game Engine That Can

The Tiny JavaScript Game Engine That Can! ??

Frank Force 2.4k Nov 26, 2022