import random
def randomize():
teams = ["Greece","Mexico","Italy","'Murica","Spain","Croatia","Serbia","Australia"]
used = []
m1 = []
m2 = []
m3 = []
m4 = []
def matchmake(mat,number):
ri = random.randint(0,(7 - (2 * (number - 1))))
mat.append(teams[ri])
teams.remove(teams[ri])
ri = random.randint(0,(6 - (2 * (number - 1))))
mat.append(teams[ri])
teams.remove(teams[ri])
print(mat)
matchmake(m1,1)
matchmake(m2,2)
matchmake(m3,3)
matchmake(m4,4)
randomize()
var mines = []
function addcords() {
for (let i = 11; i < 90; i++) {
if (String(i)[0] != "9" && String(i)[0] != "0") {
if (String(i)[1] != "9" && String(i)[1] != "0")
mines.push({id:i, ms:0})
}
}
}
function placemines() { // early development, final should be more complex
for (let i = 0; i < 10; i++) {
r = Math.floor(Math.random() * 65)
mines[r].ms = 9
}
}
addcords()
placemines()
console.log(mines)
mines = { // object storing ids and number of surrounding mines
cord: {
}
}
nums = [] // all possible ids
mids = [] // ids of mines
function addcords() {
for (let i = 11; i < 90; i++) {
if (String(i)[0] != "9" && String(i)[0] != "0") {
if (String(i)[1] != "9" && String(i)[1] != "0") {
mines.cord[i] = {"ms" : 0}
nums.push(i)
}
}
}
}
function placemines() { // early development, final should be more complex
for (let i = 0; i < 10; i++) {
r = Math.floor(Math.random() * 64)
if (mines.cord[nums[r]]["ms"] == 0) {
mines.cord[nums[r]]["ms"] = 9
mids.push(nums[r])
}
}
}
function calcmines() {
dvals = [-11, -10, -9, -1, 1, 9, 10, 11]
for (let i = 0; i < mids.length; i++) {
for (let j = 0; j < dvals.length; j++) {
try {
mines.cord[mids[i] + dvals[j]]["ms"] += 1
if (mines.cord[mids[i] + dvals[j]]["ms"] > 9){
mines.cord[mids[i] + dvals[j]]["ms"] -= 1
}
}
catch(err) {
}
}
}
}
addcords()
placemines()
calcmines()
console.log(mines)
console.log(mids)