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 / virtual-reality.py
Created March 28, 2023 13:29
Virtual Reality Game Written In Python
import pygame,sys
import random
# Initialize Pygame
pygame.init()
# Set up the game window
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
window = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
@R3DHULK
R3DHULK / virtual-reality.rb
Created March 28, 2023 13:22
Virtual Reality Game Written In Ruby
# Virtual reality game in Ruby
# Define the game map
GAME_MAP = {
"room1" => { "name" => "Room 1", "description" => "You are in a dimly lit room. There is a door to the east.", "east" => "room2" },
"room2" => { "name" => "Room 2", "description" => "You are in a hallway. There are doors to the north and south.", "north" => "room3", "south" => "room1" },
"room3" => { "name" => "Room 3", "description" => "You are in a bright room. There is a door to the south.", "south" => "room2" }
}
# Define the player class
@R3DHULK
R3DHULK / simon_says.rb
Created March 28, 2023 13:18
Simon Says In Ruby
# Simon Says game in Ruby
# Define an array of valid Simon Says commands
SIMON_SAYS_COMMANDS = ["simon says", "Simon says", "SIMON SAYS"]
# Define the game function
def play_simon_says(num_rounds)
puts "Welcome to Simon Says!"
# Loop through the specified number of rounds
@R3DHULK
R3DHULK / monster-battle.rb
Created March 28, 2023 13:14
Monster Battle Game Written In Ruby
# Monster battle game in Ruby
class Monster
attr_accessor :name, :health, :attack
def initialize(name, health, attack)
@name = name
@health = health
@attack = attack
end
@R3DHULK
R3DHULK / towerofhanoi.rb
Created March 28, 2023 13:08
Tower Of Hanoi Game Written In Ruby
# Tower of Hanoi game in Ruby
def tower_of_hanoi(num_disks, from_rod, to_rod, aux_rod)
if num_disks == 1
puts "Move disk 1 from #{from_rod} to #{to_rod}"
return
end
tower_of_hanoi(num_disks-1, from_rod, aux_rod, to_rod)
puts "Move disk #{num_disks} from #{from_rod} to #{to_rod}"
@R3DHULK
R3DHULK / wild-life-park-simulator.rb
Created March 28, 2023 13:02
Wild Life Park Simulator In Ruby
class Animal
attr_accessor :name, :species, :age
def initialize(name, species, age)
@name = name
@species = species
@age = age
end
def info
@R3DHULK
R3DHULK / whac-the-mole.rb
Created March 28, 2023 11:02
Whac The Mole Written In Ruby
class WhacAMole
attr_reader :score
def initialize(num_holes)
@num_holes = num_holes
@holes = Array.new(num_holes) { Hole.new }
@score = 0
end
def start
@R3DHULK
R3DHULK / football-game.rb
Created March 28, 2023 10:57
Text Based Football Game In Ruby
class Team
attr_accessor :name, :players
def initialize(name)
@name = name
@players = []
end
def add_player(player)
@players << player
@R3DHULK
R3DHULK / farming-game.py
Created March 28, 2023 10:49
Farm Simulating Game In Python
import random
# Define Crop class
class Crop:
def __init__(self, name, growth_rate, water_need, light_need):
self.name = name
self.growth_rate = growth_rate
self.water_need = water_need
self.light_need = light_need
self.age = 0
@R3DHULK
R3DHULK / farming-game.rb
Created March 28, 2023 10:42
Farm Simulating Game Written In Ruby
# Define Crop class
class Crop
attr_reader :name, :growth_rate, :water_need, :light_need
def initialize(name, growth_rate, water_need, light_need)
@name = name
@growth_rate = growth_rate
@water_need = water_need
@light_need = light_need
@age = 0