Skip to content

Instantly share code, notes, and snippets.

View R3DHULK's full-sized avatar
🏠
Working from home

Sumalya Chatterjee R3DHULK

🏠
Working from home
View GitHub Profile
@R3DHULK
R3DHULK / volleyball-game.r
Created March 7, 2023 07:23
Text Based Volleyball Game In R
# Text-based volleyball simulator game
# Define function to check if the ball is in bounds
is_in_bounds <- function(position) {
return(position >= 0 && position <= 10)
}
# Define function to simulate a serve
serve <- function() {
cat("Server is serving...\n")
@R3DHULK
R3DHULK / flight-simulating-game.r
Created March 7, 2023 07:12
Text Based Flight Simulating Game In R
# Basic text-based flight simulator game in R
# Define starting variables
altitude <- 0
fuel <- 100
distance <- 0
speed <- 0
game_over <- FALSE
# Define functions for game actions
@R3DHULK
R3DHULK / soccer-game.r
Created March 7, 2023 06:59
Text Based Soccer Game In R
# Define the teams
teams <- list(
c("Manchester United", "Red Devils", "4-4-2", 87),
c("Real Madrid", "Los Blancos", "4-3-3", 91),
c("FC Barcelona", "Blaugrana", "4-3-3", 89),
c("Bayern Munich", "FC Hollywood", "4-2-3-1", 88)
)
# Define a function to simulate a match
simulate_match <- function(home_team, away_team) {
@R3DHULK
R3DHULK / computer-programming-simulator3.r
Created March 7, 2023 06:50
Text Based Computer Programming Simulator In R
# Welcome message
cat("Welcome to the Computer Programming Simulator Game!\n")
cat("In this game, you'll be writing code to complete various programming challenges.\n")
cat("You'll earn points for each completed challenge, and you'll progress through different levels as you earn more points.\n")
cat("Let's get started!\n\n")
# Set up initial game state
points <- 0
level <- 1
@R3DHULK
R3DHULK / computer-programming-simulator2.r
Created March 7, 2023 06:48
Computer Programming Simulator In R
# Function to generate a random programming language
generate_language <- function() {
languages <- c("Python", "JavaScript", "Java", "C++", "Ruby", "PHP", "Swift", "Go", "R")
return(sample(languages, 1))
}
# Function to generate a random programming problem
generate_problem <- function() {
problems <- c("FizzBuzz", "Reverse a string", "Count the vowels", "Check if a number is prime", "Find the largest element in an array", "Sort an array of numbers", "Implement a stack", "Implement a queue")
return(sample(problems, 1))
@R3DHULK
R3DHULK / computer-programming-simulator.r
Created March 7, 2023 06:43
Text Based Computer Programming Simulator In R
# Define the programming challenges
challenges <- list(
list(
description = "Create a function that takes two arguments and returns their sum.",
test_cases = list(
list(args = list(1, 2), expected_output = 3),
list(args = list(3, 5), expected_output = 8),
list(args = list(-2, 7), expected_output = 5)
)
),
@R3DHULK
R3DHULK / yoga-simulator-game.r
Created March 7, 2023 06:37
Text Based Yoga Simulator Game In R
# Define yoga poses
yoga_poses <- c("Downward Dog", "Warrior I", "Warrior II", "Tree Pose", "Child's Pose", "Cobra Pose", "Triangle Pose", "Eagle Pose", "Plank Pose", "Savasana")
# Define player attributes
player_name <- readline(prompt = "What is your name? ")
player_level <- 1
player_experience <- 0
player_energy <- 100
# Define game functions
@R3DHULK
R3DHULK / shooting-game.r
Created March 7, 2023 06:29
Text Based Shooting Game In R
# Define variables for player and enemy health
player_health <- 100
enemy_health <- 100
# Define function for shooting action
shoot <- function() {
# Generate a random hit probability between 0 and 1
hit_prob <- runif(1, 0, 1)
# Determine if the player hit or missed
@R3DHULK
R3DHULK / dance-game.r
Created March 7, 2023 06:14
Text Based Dance Game In R
# Function to play the dance game
play_dance_game <- function() {
cat("Welcome to the dance simulator game!\n")
cat("Follow the dance moves by entering the corresponding numbers on your keyboard.\n")
cat("Press ENTER to start the game.\n")
readline()
# Set up dance moves and their corresponding numbers
dance_moves <- list("Jump", "Turn left", "Turn right", "Spin", "Kick", "Squat")
dance_numbers <- c(1, 2, 3, 4, 5, 6)
@R3DHULK
R3DHULK / gym-game.r
Created March 7, 2023 06:09
Text Based Gym Simulator In R
# Define gym parameters
max_members <- 50
gym_capacity <- 30
equipment <- c("Treadmill", "Stationary bike", "Elliptical machine", "Weightlifting bench")
equipment_count <- length(equipment)
cost_per_month <- 50
revenue_per_member <- 30
# Initialize gym state
members <- 0