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 / city-building-game.r
Created March 27, 2023 17:41
City Building Game Written In R
money <- 1000
population <- 10
city_name <- ""
buildings <- list()
display_menu <- function() {
cat("------------------\n")
cat("What do you want to do?\n")
cat("1. Build a building\n")
cat("2. Destroy a building\n")
@R3DHULK
R3DHULK / city-building-game.rb
Created March 27, 2023 17:37
City Building Game In Ruby
class CityBuilderGame
def initialize
@money = 1000
@population = 10
@city_name = ""
@buildings = []
end
def start
puts "Welcome to the City Builder game!"
@R3DHULK
R3DHULK / adventure-game.rb
Created March 27, 2023 17:29
Adventure Game Written In Ruby
class AdventureGame
def initialize
@player = { name: "", health: 100, inventory: [] }
@current_room = 0
@rooms = [
{
name: "Forest",
description: "You are standing in a dark forest. There is a path to your left and right.",
paths: [1, 2],
items: [:stick]
@R3DHULK
R3DHULK / wild-west.rb
Created March 27, 2023 17:11
Western Wild In Ruby
class WesternGame
def initialize
@player_health = 100
@enemy_health = 100
end
def start
puts "Welcome to the Western Game!\n"
while @player_health > 0 && @enemy_health > 0
@R3DHULK
R3DHULK / trivia.rb
Created March 27, 2023 17:02
Trivia Game Written In Ruby
require 'json'
require 'net/http'
class TriviaGame
def initialize
@score = 0
end
def start
puts "Welcome to the Trivia Game!"
@R3DHULK
R3DHULK / tic-tac-toe.go
Created March 27, 2023 16:54
Tic Tac Toe In Golang
package main
import (
"fmt"
)
func main() {
// Initialize the board
board := [9]string{" ", " ", " ", " ", " ", " ", " ", " ", " "}
@R3DHULK
R3DHULK / tic-tac-toe.rb
Created March 27, 2023 16:32
Tic Tac Toe Written In Ruby
class TicTacToe
def initialize
@board = Array.new(3) { Array.new(3, " ") }
@current_player = "X"
end
def play
loop do
display_board
print_turn_prompt
@R3DHULK
R3DHULK / hangman.rb
Created March 22, 2023 15:25
Text Based Hangman Game In Ruby
class Hangman
MAX_GUESSES = 6
def initialize(word)
@word = word.upcase
@guesses = []
@incorrect_guesses = 0
end
def play
@R3DHULK
R3DHULK / hangman.go
Created March 22, 2023 15:10
Text Based Hangman Game Written In GOLang
package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
var words = []string{
@R3DHULK
R3DHULK / cricket-game.py
Created March 22, 2023 14:40
GUI Based Cricket Game In Python
import tkinter as tk
import random
class CricketGame:
def __init__(self, master):
self.master = master
self.master.title("Cricket Game")
# Labels
self.runs_label = tk.Label(master, text="Runs: 0")