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
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
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
function minimax(level, player) { | |
if (checkWin(player) || level === 0 || checkWin(AI)) { | |
score = evaluate(); | |
return score; | |
} | |
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
function minimax(level, player) { | |
if (checkWin(player) || level === 0 || checkWin(AI)) { | |
score = evaluate(); | |
return score; | |
} |
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
// Tic Tac Toe with miniMax algorithm | |
$(document).ready(function () { | |
var moves; | |
var coords = []; | |
var what; | |
var where; | |
var imageUrl = "https://srichinmoy.files.wordpress.com/2013/12/cock.jpg"; |
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
#bmi calculator | |
numbers = %w(91 1.80 | |
60 1.62 | |
48 2.00 | |
49 1.32 | |
90 2.37 | |
95 2.30 | |
94 2.29 | |
104 2.40 |
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
numbers = %w(-4953066 2629785 -5777626 | |
8415931 4699071 3832995 | |
7424130 1554574 9291366 | |
-2638056 8806036 -3576544 | |
-3067030 6695809 7141481 | |
-7202215 4497599 3429471 | |
-1610641 -7891372 213522 | |
-7124492 -4169781 -1367309 | |
-8841642 1315845 7180330 | |
-5649708 2964479 -5931762 |
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
numbers = %w(-4953066 2629785 -5777626 | |
8415931 4699071 3832995 | |
7424130 1554574 9291366 | |
-2638056 8806036 -3576544 | |
-3067030 6695809 7141481 | |
-7202215 4497599 3429471 | |
-1610641 -7891372 213522 | |
-7124492 -4169781 -1367309 | |
-8841642 1315845 7180330 |
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
class TravelAgentSession | |
def year=(y) | |
@year = y.to_i | |
if @year > 100 | |
@year = @year + 2000 | |
end | |
end | |
end | |
agnis = TravelAgentSession.new |
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
#This works: | |
class Ticket | |
def price # | |
@price # this will be moved to the bottom below on the 2nd example | |
end # | |
def price(amount) | |
if (amount * 100).to_i == amount * 100 | |
@price = amount | |
else |