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
import SwiftUI | |
import UIKit | |
struct TextInputView: View { | |
@State private var textFieldText = "" | |
var body: some View { | |
TextField("Type here", text: $textFieldText) | |
.textFieldStyle(RoundedBorderTextFieldStyle()) | |
.padding() |
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
import SwiftUI | |
// 1. Use looped H/VStacks to create a grid | |
// 2. Conditionally increase spacing to grow/shrink the grid | |
// 3. Calculate the distance of each dot to the center and use the value to stagger the animation | |
//4. Add random delay on top of the staggered delay value | |
struct ContentView: View { | |
// const & state |
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
// | |
// ContentView.swift | |
// Scribe | |
// | |
// Created by Cyril Zakka on 7/21/19. | |
// Copyright © 2019 Cyril Zakka. All rights reserved. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
struct Card : Identifiable { | |
var id = UUID() | |
var imageName: String | |
} | |
struct CardView: View { | |
var card: Card | |
var body: some View { |
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
import numpy as np | |
import random | |
import time | |
import gym | |
from gym import wrappers | |
random.seed(1234) | |
np.random.seed(1234) | |
def generate_random_policy(): |
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
import numpy as np | |
import gym | |
import time | |
def generate_random_policy(): | |
# Generates a vector of shape (16,) with an action between 0 and 3 (inclusive) | |
return np.random.choice(4, size=((16))) | |
def run_episode(env, policy, n_episodes=100, render=False): | |
total_reward = 0 |