Racers-API - a game where you have to go around racing with your car, earning money

Overview

Racers-API

About

Racers API is a game where you have to go around racing with your car, earning money. With that money you can buy cars and progress through the game! You have to combine your coding skills and knowledge to start and finish. Making HTTP requests to the API and getting a response is what you need to learn. You can play Racers API with any language that supports HTTP requests. Learn more in the Documentation section

Documentation

Python

Checking the status of the server:

import requests

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

If it outputs "Racers API is ready to play!" then the server is available. Otherwise, you might get an error. If that happens and all you code is correct, it means the server is likely down.

Getting a key and starting off:

import requests
import json

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

#Getting an API key
username = "hello"
startURL = "https://racersapi.billybob456.repl.co/start/" + username

x = requests.get(startURL)
x = x.content
x = json.loads(x)
key = x["key"]
print(x["message"])

Getting your account information:

import requests
import json

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

#Getting an API key
username = "hello"
startURL = "https://racersapi.billybob456.repl.co/start/" + username

x = requests.get(startURL)
x = x.content
x = json.loads(x)
key = x["key"]
print(x["message"])

account = requests.get("https://racersapi.billybob456.repl.co/account/" + key).content.decode("utf-8")
print(account)

Getting your current car:

import requests
import json
import ast

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

#Getting an API key
username = "hello"
startURL = "https://racersapi.billybob456.repl.co/start/" + username

x = requests.get(startURL)
x = x.content
x = json.loads(x)
key = x["key"]
print(x["message"])

account = ast.literal_eval(requests.get("https://racersapi.billybob456.repl.co/account/" + key).content.decode("utf-8"))
print(account)

currentCar = account["car"]
print(currentCar)

Getting the available races:

...
availableRaces = requests.get("https://racersapi.billybob456.repl.co/available-races/" + key).content.decode("utf-8")
print(availableRaces)

Selecting the race with best difficult:payout ratio:

...
#Selecting the best race with difficulty:payout ratio
litEvalList = ast.literal_eval(availableRaces)
length = len(litEvalList)
for race in litEvalList:
	avgSpeed = race["average top speed"]
	if avgSpeed == currentCar["top speed"]:
		raceNum = litEvalList.index(race)
raceKey = json.loads(availableRaces)[raceNum]["key"]

Racing the selected race:

...
#Racing the selected race
raceURL = "https://racersapi.billybob456.repl.co/race/" + key + "/" + raceKey
raceResults = requests.get(raceURL).content.decode('utf-8')
raceKey = ""
raceResults = ast.literal_eval(raceResults)
key = raceResults["key"] #new key
print(raceResults["message"])

Full script:

import requests
import json
import ast

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

#Getting an API key
username = "hello"
startURL = "https://racersapi.billybob456.repl.co/start/" + username

x = requests.get(startURL)
x = x.content
x = json.loads(x)
key = x["key"]
print(x["message"])

#Getting account information
account = ast.literal_eval(requests.get("https://racersapi.billybob456.repl.co/account/" + key).content.decode("utf-8"))
print(account)

#Getting you current car
currentCar = account["car"]
print(currentCar)

#Getting available races
availableRaces = requests.get("https://racersapi.billybob456.repl.co/available-races/" + key).content.decode("utf-8")
print(availableRaces)

#Selecting the best race with difficulty:payout ratio
litEvalList = ast.literal_eval(availableRaces)
length = len(litEvalList)
for race in litEvalList:
	avgSpeed = race["average top speed"]
	if avgSpeed == currentCar["top speed"]:
		raceNum = litEvalList.index(race)
raceKey = json.loads(availableRaces)[raceNum]["key"]

#Racing the selected race
raceURL = "https://racersapi.billybob456.repl.co/race/" + key + "/" + raceKey
raceResults = requests.get(raceURL).content.decode('utf-8')
raceKey = ""
raceResults = ast.literal_eval(raceResults)
key = raceResults["key"]
print(raceResults["message"])

Well done! You've successfully gone through the basics of Racers API and completed your first race! Below are your next steps.

After getting you new key, you want to save it somewhere! Here's a modified script of the full script that will allow you to continue your game with the new key:

import requests
import json
import ast

#Checking the status of the server
statusURL = "https://racersapi.billybob456.repl.co/status"
status = requests.get(statusURL)
status = status.content.decode("utf-8")
print(status)
if status == "Racers API is ready to play!":
	pass
else:
	print("Racers API is unavailable to play at the moment")
	exit()

key = "YOUR KEY HERE!" #put your key in there!

#Getting account information
account = ast.literal_eval(requests.get("https://racersapi.billybob456.repl.co/account/" + key).content.decode("utf-8"))
print(account)

#Getting you current car
currentCar = account["car"]
print(currentCar)

#Getting available races
availableRaces = requests.get("https://racersapi.billybob456.repl.co/available-races/" + key).content.decode("utf-8")
print(availableRaces)

#Selecting the best race with difficulty:payout ratio
litEvalList = ast.literal_eval(availableRaces)
length = len(litEvalList)
for race in litEvalList:
	avgSpeed = race["average top speed"]
	if avgSpeed == currentCar["top speed"]:
		raceNum = litEvalList.index(race)
raceKey = json.loads(availableRaces)[raceNum]["key"]

#Racing the selected race
raceURL = "https://racersapi.billybob456.repl.co/race/" + key + "/" + raceKey
raceResults = requests.get(raceURL).content.decode('utf-8')
raceKey = ""
raceResults = ast.literal_eval(raceResults)
key = raceResults["key"]
print(raceResults["message"])

More documentation coming out soon including how to buy new cars and mod the game to add your own cars!

Email guesser - Guessing BF email based on emailGuesser by WhiteHatInspector

email_guesser Guessing BF email based on emailGuesser by WhiteHatInspector (http

4 Dec 25, 2022
使用python编写2048游戏及自动玩

使用python编写2048游戏及自动玩

tiger-wang 68 Dec 23, 2022
source codes for my(small indie game developer) games

My repository for most of my finished && unfinished games Table of Contents Getting Started Prerequisites Installation Usage License Contact Prerequis

Gustavs Jākobsons 1 Jan 30, 2022
Jogo Flappy Bird com phyton e phygame

Flappy-Bird Tecnologias usadas Requisitos para inicializar o jogo: Python faça o download em: https://www.python.org/ Pygame faça o download em: https

João Guilherme 1 Dec 06, 2021
A base chess engine that makes moves on an instance of board.

A base chess engine that makes moves on an instance of board.

0 Feb 11, 2022
This is a two player snake game

Trake This is a two player snake game How to play the game There is food and two players. You try to eat food to become large and gain points. Player

Grrub 1 Dec 19, 2021
Abandoned plan for a clone of the old Flash game Star Relic

space-grid When I was in middle school, I was a fan of the Flash game Star Relic (no longer playable in modern browsers, but it works alright in Flash

Radon Rosborough 3 Aug 23, 2021
Disables the chat in League of Legends for Windows.

Disables the chat in League of Legends for Windows. If you simply can't stop yourself from typing LeagueStop will play KEKW.mp3 each time you try. The sound will stack & becomes horribly annoying.

1 Nov 24, 2021
A simple game with the main idea to be: Guess The Number

GuessTheNumber GuessTheNumber is a simple game I made using Python. The main mechanic of the game is to guess the number that randomly generated from

0 Jun 24, 2022
Frets on Fire X: a fork of Frets on Fire with many added features and capabilities

Frets on Fire X - FoFiX This is Frets on Fire X, a highly customizable rhythm game supporting many modes of guitar, bass, drum, and vocal gameplay for

FoFiX 377 Jan 02, 2023
A visualization of how much Manchester United fans enjoyed each game from the first half of the 21/22 Premier League season.

Man-Utd-Fan-Satisfaction-Levels-First-19-games A visualization of how much Manchester United fans enjoyed each game from the first half of the 21/22 P

1 Jan 19, 2022
Minecraft.nix - Command line Minecraft launcher managed by nix

minecraft.nix Inspired by this thread, this flake contains derivations of both v

12 Sep 06, 2022
A simple python script to pregenerate minecraft worlds.

mcloady mcloady is a lightweight python script used to pre-generate Minecraft terrain using MCRcon and carpet mod (optional). Inspired by Pre-Generati

5 Dec 08, 2021
🪨 📄 ✂ game in python with recursion

🪨 📄 ✂ Game Rock Paper Scissor game in python with recursion ⚙️ Developer's Guide Things you need to get started with this code:- Download python3 fr

Atul Anand 3 Jul 25, 2022
Flappy Bird clone utilizing facial recognition to move the

Flappy Face Flappy Bird clone utilizing facial recognition to move the "bird" How it works Flappy Face uses Facial Recognition to detect your face's p

Brady McDermott 1 Jan 11, 2022
PyCraft - A Minecraft launcher made in python

A Minecraft launcher made in python. The main objective of this launcher is to enable players to enjoy minecraft (especially those without a mojang/microsoft account). This launcher is not illegal as

38 Dec 12, 2022
A full featured game of falling pieces using python's pygame library.

A full featured game of falling shapes using python's pygame library. Key Features • How To Play • Download • Contributing • License Key Features Sing

Giovani Rodriguez 7 Dec 14, 2022
Implementation of the Spider-Man Game

Projeto FPRO FPRO/LEIC, 2021/22 Francisco Campos (up202108735) 1LEIC08 Objetivo Criar um clone do clássico Spider-Man em Pygame... Repositório de códi

1 Dec 24, 2021
A simple script which allows you to see how much GEXP you earned for playing in the last Minecraft Hypixel server session

Project Landscape A simple script which allows you to see how much GEXP you earned for playing in the Minecraft Server Hypixel Usage Install python 3.

Vincenzo Deluca 4 Dec 18, 2021
Un semplice Snake game , come negli anni 90!

Project-SnakeGame Un semplice Snake game , come negli anni 90! ITA VI porto un semplice giochino per i nostalgini degli anni 90 , ispirato al vecchio

Matt K Lawrence 1 Oct 17, 2021