This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define the game map as a matrix | |
game_map <- matrix(c( | |
"##########", | |
"# | #", | |
"# @ #", | |
"# | #", | |
"# #", | |
"# | #", | |
"##########" | |
), nrow = 7, byrow = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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): ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up the system | |
password <- "secret" | |
firewall <- 1 | |
security_level <- 1 | |
vulnerabilities <- c("weak_password", "unpatched_system") | |
# Game loop | |
while (TRUE) { | |
# Clear the screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) { |