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 / train-simulator.r
Created March 7, 2023 19:13
Text Based Train Simulator In R
# define the initial state of the game
game_state <- list(
time = 0,
speed = 0,
position = 0,
distance = 1000,
max_speed = 100,
acceleration = 10,
braking = 20
)
@R3DHULK
R3DHULK / world-wide-adventure.r
Created March 7, 2023 09:47
World Wide Adventure Game In R
# define the game map as a matrix
game_map <- matrix(c(
"##########",
"# | #",
"# @ #",
"# | #",
"# #",
"# | #",
"##########"
), nrow = 7, byrow = TRUE)
@R3DHULK
R3DHULK / stock-market-simulator.r
Created March 7, 2023 09:43
Text Based Stock Market Simulation Written In R
# define the initial balance and starting price of the stock
balance <- 1000
price <- 50
# define a function to buy shares of the stock
buy <- function(shares) {
cost <- shares * price
if (cost > balance) {
print("Insufficient funds.")
} else {
@R3DHULK
R3DHULK / schooling-system.r
Created March 7, 2023 09:29
Text Based Schooling System In R
# Set up the initial variables
classes <- list("Math", "English", "Science", "History")
students <- list()
teachers <- list()
quit <- FALSE
# Define the functions for adding students and teachers
add_student <- function() {
name <- readline(prompt="Enter student name: ")
class <- readline(prompt="Enter student class (Math, English, Science, or History): ")
@R3DHULK
R3DHULK / space-combat-simulator2.r
Created March 7, 2023 09:24
Text Based Space Combat Simulator In R
# Define initial player and enemy stats
player_hp <- 100
player_attack <- 10
enemy_hp <- 50
enemy_attack <- 5
# Loop until either player or enemy is defeated
while (player_hp > 0 && enemy_hp > 0) {
# Display current status
cat("Your ship: HP =", player_hp, "\n")
@R3DHULK
R3DHULK / space-combat-simulator.r
Created March 7, 2023 09:21
Text Based Space Combat Simulator In R
# Set up the game
player_ship <- list(name = "Player's Ship", hp = 10, damage = 2)
enemy_ship <- list(name = "Enemy Ship", hp = 10, damage = 1)
turn_count <- 0
# Game loop
while (player_ship$hp > 0 && enemy_ship$hp > 0) {
# Clear the screen
cat("\033[2J\033[;H")
@R3DHULK
R3DHULK / hacking-simulator.r
Created March 7, 2023 09:13
Text Based Hacking Simulator In R
# Set up the system
password <- "secret"
firewall <- 1
security_level <- 1
vulnerabilities <- c("weak_password", "unpatched_system")
# Game loop
while (TRUE) {
# Clear the screen
@R3DHULK
R3DHULK / hacking-simulator.r
Created March 7, 2023 09:11
Text Based Hacking Simulator In R
# Set up the game
set.seed(123)
password <- paste0(sample(0:9, 4, replace = TRUE), collapse = "")
guesses <- c()
remaining_attempts <- 10
# Game loop
while (remaining_attempts > 0) {
# Print game status
cat("\n------------------------------\n")
@R3DHULK
R3DHULK / hacking-simulator.r
Created March 7, 2023 09:07
Text Based Hacking Simulator In R
# Hacking Simulator
# By ChatGPT
# Set up the target system
password <- "mysecretpassword"
target_system <- list(
files = list(
"document.txt" = "This is a sensitive document.\n"
),
password = password
@R3DHULK
R3DHULK / hacking-simulator.r
Created March 7, 2023 09:04
Text Based Hacking Simulator In R
# Define a function for generating a random IP address
generate_ip <- function() {
paste(sample(0:255, 4, replace=TRUE), collapse=".")
}
# Set up the initial target
target_ip <- generate_ip()
# Game loop
while (TRUE) {