Skip to content

Instantly share code, notes, and snippets.

View timoshka88's full-sized avatar

Fatima Khalilova timoshka88

  • DBC
  • San Francisco - Cayman islands
View GitHub Profile
# 1. Each player has two 10x10 boards with columns labeled 1-10 and rows labeled A-J, one labeled "Your Ships"
# to represent their own ships and one to represent their opponent's board, labeled "Enemy Ships"
# 2.Each player arranges their ships on their own board (see fleet table)
# 3.Take turns firing a salvo at your opponent, calling out squares as "A3", "B6", etc.
# Salvo = number of your ships you have left (use counter) / 1 shot.
# 4.Mark salvos fired on the "Enemy Ships" grid (/ marks a miss, i.e. water; X marks a hit).
# You must call out when your ship is sunk completely.
# Setting up the environment
# User plays against the computer
@timoshka88
timoshka88 / jquery_example.html
Created March 13, 2014 00:43 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
<!DOCTYPE html>
<html>
<head>
<title>DOM manipulation with jQuery</title>
<!-- Add a link to jQuery CDN here script here -->
<script type="text/javascript" src="jquery_example.js"></script>
</head>
<body>
@timoshka88
timoshka88 / jquery_example.html
Last active August 29, 2015 13:57 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
<!DOCTYPE html>
<html>
<head>
<title>DOM manipulation with jQuery</title>
<!-- Add a link to jQuery CDN here script here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery_example.js"></script>
</head>
@timoshka88
timoshka88 / command_line_challeng
Last active August 29, 2015 13:56
practicing different CLI commands
cheatsheet that helped me during this challenge:
http://www.westwind.com/reference/os-x/commandline/text-files.html)
429 git clone https://github.com/dbc-challenges/CLI-Obstacle-Course desktop/command_line
430 cd desktop/command_line/"CLI-Obstacle-Course"
431 cd desktop/command_line
432 ls
433 ls -la
434 mv images app/assets
435 ls -la app/asset
@timoshka88
timoshka88 / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
#as with the PezDispenser, i decided to try out new things, and here is what I got
class Board_games
attr_reader :board # make the board possible to view
def initialize (board = [])
puts "Board ready, if you want to mix the letters and start with a new board, just shake"
@board = board
the_choice_of_letters = ('a'..'z').to_a
@timoshka88
timoshka88 / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
class BoggleBoard
attr_reader :board # make the board possible to view by using the attribute reader
def initialize (board)
puts "Board is ready"
@board = board
end
#initializing the default variable of a newly created instance. And every time a new instance is created, the user will get
@timoshka88
timoshka88 / Cipher.rb
Last active January 3, 2016 12:28
Decoding and encoding
def north_korean_cipher(coded_message)
input = coded_message.downcase.split("")
characters = ('a'..'z').to_a
rotated_characters = characters.rotate(4)
cipher = Hash[rotated_characters.zip(characters)]
decoded_sentence = input.collect do |x|
if cipher.has_key?(x)
x = cipher[x]
elsif x.match(/[\@\#\$\%\^\&\*]/)
@timoshka88
timoshka88 / Fibonacci.rb
Last active January 3, 2016 09:19
does i belong to the Fibonacci sequence?
require 'bigdecimal' #require the bigdecimal, since Fibonacci sequence can have very large numbers, and for working with large numbers we would need to call the methods of exactly this class
def is_fibonacci?(i)
return true if i == 0 || i == 1 #if this is not specified, Ruby will be returning an FloatDomain Error, negative value, for the 0 passed in as an argument
i = BigDecimal.new(i) #setting the variable so that the code can also work with big numbers
fib_number = (5 * i**2 + 4).sqrt(0) #calling the method "sqrt" of BigDecimal class to return the square root, and this will work for large numbers also
fib_number_two = (5 * i**2 - 4).sqrt(0)
@timoshka88
timoshka88 / bakery_GPS 1.1.rb
Last active January 3, 2016 04:38
refactoring_bakery_GPS 1.1
# Background
# Your future career will require you to deal with a lot of "legacy code,"
# i.e. code that works as intended, but is difficult to modify.
# Sometimes you will be given the option to start over or modify the original code.
# Other times you will be forced to work with legacy code due to time or budget constraints.
# In this challenge, you have the option to completely trash the code and start
# over or work with the code that's here, but make sure that it works the same way.
# The driver code should still print "true" without being modified.