Added so much stuff I forgot
This commit is contained in:
parent
952112be15
commit
d1f8f7294b
BIN
Fall 2024/.DS_Store
vendored
Normal file
BIN
Fall 2024/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-136ページ.pdf
Normal file
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-136ページ.pdf
Normal file
Binary file not shown.
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-43ページ.pdf
Normal file
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-43ページ.pdf
Normal file
Binary file not shown.
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-44と45ページ.pdf
Normal file
BIN
Fall 2024/JPNS 101/Assignments/ホールドラップ-101-1-44と45ページ.pdf
Normal file
Binary file not shown.
BIN
Fall 2024/PHYS112/PHYS112_RQ3_F24 2.pdf
Normal file
BIN
Fall 2024/PHYS112/PHYS112_RQ3_F24 2.pdf
Normal file
Binary file not shown.
5
Fall 2024/Research/pygameSim/CytoSim/.gitignore
vendored
Normal file
5
Fall 2024/Research/pygameSim/CytoSim/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
__pycache__/graph.cpython-312.pyc
|
||||
__pycache__/particle.cpython-312.pyc
|
||||
|
||||
__pycache__/sensor.cpython-312.pyc
|
||||
__pycache__/slider.cpython-312.pyc
|
||||
2
Fall 2024/Research/pygameSim/CytoSim/README.md
Normal file
2
Fall 2024/Research/pygameSim/CytoSim/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# CytoSim
|
||||
|
||||
26
Fall 2024/Research/pygameSim/CytoSim/graph.py
Normal file
26
Fall 2024/Research/pygameSim/CytoSim/graph.py
Normal file
@ -0,0 +1,26 @@
|
||||
import pygame
|
||||
|
||||
class Graph:
|
||||
def __init__(self, ratio, max_time, center, y_scale):
|
||||
self.ratio = ratio
|
||||
self.max_time = max_time
|
||||
self.center = center
|
||||
self.y_scale = y_scale
|
||||
self.data = []
|
||||
|
||||
def draw(self, screen, x, y, time_scale):
|
||||
rect = pygame.Rect(0, 0, x, y / self.ratio)
|
||||
pygame.draw.rect(screen, (0,0,0), rect)
|
||||
self.draw_data(x, y, screen, time_scale)
|
||||
|
||||
def add_data(self, time, value):
|
||||
self.data.append([time, value])
|
||||
|
||||
def get_data(self):
|
||||
return self.data
|
||||
|
||||
def draw_data(self, x, y, screen, time_scale):
|
||||
offset = 0
|
||||
for i in range(len(self.data) - 1, -1, -1):
|
||||
pygame.draw.circle(screen, (255,0,0), (x - offset ,(y / (2 * self.ratio)) + self.data[i][1] * 10), 1)
|
||||
offset += time_scale * 10
|
||||
181
Fall 2024/Research/pygameSim/CytoSim/main.py
Normal file
181
Fall 2024/Research/pygameSim/CytoSim/main.py
Normal file
@ -0,0 +1,181 @@
|
||||
import pygame
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
from particle import Particle
|
||||
from sensor import Sensor
|
||||
from slider import Slider
|
||||
|
||||
pygame.init()
|
||||
pygame.display.set_caption("CytoSim")
|
||||
|
||||
SCREEN_WIDTH = 800
|
||||
SCREEN_HEIGHT = 600
|
||||
|
||||
SENSOR_DISTANCE = 200
|
||||
REST_MEDIUM = 180000
|
||||
|
||||
y_lim = 40000
|
||||
y_lim2 = 0.000000000005
|
||||
|
||||
|
||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
|
||||
sensor = Sensor(width = 50, distance = SENSOR_DISTANCE, space = 300)
|
||||
sensor.inputVoltage(5, -5)
|
||||
|
||||
|
||||
|
||||
silica = Particle(speed = 1, size = 60, perm = 4, rest = pow(10, 12))
|
||||
|
||||
time = .1
|
||||
time_data = []
|
||||
volume_data = []
|
||||
sensor_data = []
|
||||
rest_data = []
|
||||
current1_data = []
|
||||
current2_data = []
|
||||
|
||||
|
||||
"""plt.ion()
|
||||
fig, (ax, ax2) = plt.subplots(2, 1, figsize=(5, 5))
|
||||
line, = ax.plot([], [], 'r-')
|
||||
line2, = ax.plot([], [], 'g-')
|
||||
line3, = ax2.plot([], [], 'b-')
|
||||
line4, = ax2.plot([], [], 'g-')
|
||||
ax.set_xlim(0, 900)
|
||||
ax.set_ylim(-0.01, y_lim)
|
||||
ax.set_xlabel('Time (s)', fontsize = 6)
|
||||
ax.set_ylabel('Volume', fontsize = 6)
|
||||
ax.set_title('Volume/time', fontsize = 8)
|
||||
|
||||
ax2.set_xlim(0, 900)
|
||||
ax2.set_ylim(-1 * y_lim2, y_lim2)
|
||||
ax2.set_xlabel('Time (s)', fontsize = 6)
|
||||
ax2.set_ylabel('Current', fontsize = 6)
|
||||
ax2.set_title('Current/time', fontsize = 8)
|
||||
|
||||
plt.subplots_adjust(hspace=0.4)
|
||||
"""
|
||||
|
||||
slider1 = Slider(20, 20, 100, 20, 20, SENSOR_DISTANCE / 2, 80)
|
||||
slider2 = Slider(20, 50, 100, 20, .1, 10, 1)
|
||||
slider3 = Slider(20, 80, 100, 20, 1, 100, 10)
|
||||
|
||||
run = True
|
||||
while run:
|
||||
|
||||
timeScale = slider2.value
|
||||
sensor.inputVoltage(slider3.value, -1 * slider3.value)
|
||||
|
||||
max_points = 1000
|
||||
if len(time_data) > max_points:
|
||||
time_data.pop(0)
|
||||
volume_data.pop(0)
|
||||
sensor_data.pop(0)
|
||||
current1_data.pop(0)
|
||||
current2_data.pop(0)
|
||||
|
||||
distance = silica.move(time)
|
||||
if distance > SCREEN_WIDTH + (silica.size * 2):
|
||||
time =.1
|
||||
time_data = []
|
||||
volume_data = []
|
||||
sensor_data = []
|
||||
rest_data = []
|
||||
current1_data = []
|
||||
current2_data = []
|
||||
|
||||
screen.fill((0,0,0))
|
||||
|
||||
sensor.generate(SCREEN_WIDTH, SCREEN_HEIGHT, screen)
|
||||
|
||||
pygame.draw.circle(screen, (255, 255, 255), (distance - silica.size, 300), silica.size)
|
||||
pygame.draw.circle(screen, (0,255,0), (distance - silica.size, 300), 10)
|
||||
|
||||
slider1.draw(screen)
|
||||
slider2.draw(screen)
|
||||
slider3.draw(screen)
|
||||
|
||||
silica.updateSize(slider1.value)
|
||||
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
run = False
|
||||
slider1.handle_event(event)
|
||||
slider2.handle_event(event)
|
||||
slider3.handle_event(event)
|
||||
|
||||
volume = sensor.getParticleVolume(distance, silica)
|
||||
|
||||
sensor_data_volume = sensor.volume - volume
|
||||
sensor_data.append(sensor_data_volume)
|
||||
|
||||
sensor_resistance = REST_MEDIUM * ((pow(sensor.distance, 2) * pow(10, -18)) / (sensor_data_volume * pow(10, -27)))
|
||||
nom_sens_res = REST_MEDIUM * ((sensor.distance * pow(10, -9)) / (sensor.width * sensor.distance * pow(10, -18)))
|
||||
|
||||
if volume:
|
||||
particle_resistance = silica.rest * pow((3/(16 * pow(math.pi, 2) * volume * pow(10, -9))), 1/3)
|
||||
total_resistance_inv = (1 / particle_resistance) + (1 / sensor_resistance)
|
||||
else:
|
||||
particle_resistance = 0
|
||||
total_resistance_inv = 1 / sensor_resistance
|
||||
|
||||
total_resistance = 1 / total_resistance_inv
|
||||
|
||||
current1 = 0
|
||||
current2 = 0
|
||||
|
||||
|
||||
which_sensor = sensor.whichSensor(distance, silica)
|
||||
if which_sensor == 1:
|
||||
current1 = sensor.voltage1 / total_resistance
|
||||
current2 = sensor.voltage2 / nom_sens_res
|
||||
elif which_sensor == 2:
|
||||
current2 = sensor.voltage2 / total_resistance
|
||||
current1 = sensor.voltage1 / nom_sens_res
|
||||
else:
|
||||
current1 = sensor.voltage1 / nom_sens_res
|
||||
current2 = sensor.voltage2 / nom_sens_res
|
||||
|
||||
current1_data.append(current1)
|
||||
current2_data.append(current2)
|
||||
print(f"{current1} = {sensor.voltage1} / {total_resistance}")
|
||||
rest_data.append(total_resistance)
|
||||
|
||||
if (volume > y_lim):
|
||||
y_lim = volume + (volume * 1.2)
|
||||
#ax.set_ylim(-1000, y_lim)
|
||||
|
||||
if (current1 > y_lim2):
|
||||
y_lim2 = current1 + (current1 * 1.2)
|
||||
#ax2.set_ylim(-1 * y_lim2, y_lim2)
|
||||
|
||||
|
||||
|
||||
time_data.append(time)
|
||||
volume_data.append(volume)
|
||||
|
||||
"""line.set_xdata(time_data)
|
||||
line.set_ydata(volume_data)
|
||||
line2.set_xdata(time_data)
|
||||
line2.set_ydata(sensor_data)
|
||||
line3.set_xdata(time_data)
|
||||
line3.set_ydata(current1_data)
|
||||
line4.set_xdata(time_data)
|
||||
line4.set_ydata(current2_data)
|
||||
ax.relim()
|
||||
ax.autoscale_view()
|
||||
ax2.relim()
|
||||
ax2.autoscale_view()
|
||||
plt.draw()
|
||||
plt.pause(0.01)
|
||||
"""
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
time = timeScale + time
|
||||
|
||||
pygame.quit()
|
||||
|
||||
|
||||
80
Fall 2024/Research/pygameSim/CytoSim/newMain.py
Normal file
80
Fall 2024/Research/pygameSim/CytoSim/newMain.py
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
import pygame
|
||||
import sys
|
||||
import math
|
||||
from sensor import Sensor
|
||||
from particle import Particle
|
||||
from slider import Slider
|
||||
from graph import Graph
|
||||
|
||||
SCREEN_WIDTH = 1352
|
||||
SCREEN_HEIGHT = 878
|
||||
|
||||
scale = 1 * pow(10, -6)
|
||||
unit_scale = -3
|
||||
time = 0
|
||||
time_scale = 1
|
||||
|
||||
sensor = Sensor( 50 * pow(10, -6), 30 * pow(10, -6), 20 * pow(10, -6))
|
||||
|
||||
particle = Particle(10 * pow(10, -8), 7 * pow(10, -6), 1, 1)
|
||||
|
||||
graph = Graph(4, 10, 0, 10)
|
||||
|
||||
pygame.init()
|
||||
pygame.display.set_caption("CytoSim")
|
||||
|
||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT), pygame.RESIZABLE)
|
||||
|
||||
while True:
|
||||
# Event handler for pygame
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
if event.type == pygame.VIDEORESIZE:
|
||||
screen = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE)
|
||||
if event.type == pygame.MOUSEWHEEL:
|
||||
print("SCROLL")
|
||||
if event.y == 1:
|
||||
scale = scale / 1.1
|
||||
elif event.y == -1:
|
||||
scale = scale * 1.1
|
||||
if event.type == pygame.KEYDOWN:
|
||||
print("Button")
|
||||
if event.key == pygame.K_UP:
|
||||
scale = scale / 1.1
|
||||
elif event.key == pygame.K_DOWN:
|
||||
scale = scale * 1.1
|
||||
|
||||
|
||||
x, y = screen.get_size()
|
||||
|
||||
scale_bar_size = abs((x - (x * .1)) - (x - (x * .1)) - (1 * pow(10, unit_scale) / scale))
|
||||
|
||||
if int(scale_bar_size) < 40:
|
||||
unit_scale += 1
|
||||
elif int(scale_bar_size) > 500:
|
||||
unit_scale -= 1
|
||||
|
||||
scale_bar_end_point = (x - (x * .1)) - (1 * pow(10, unit_scale) / scale)
|
||||
|
||||
screen.fill((200,100,5))
|
||||
|
||||
sensor.display(x, y + (y / graph.ratio), screen, scale)
|
||||
particle.move(time_scale, scale, sensor.left_limit, sensor.right_limit, screen, y + (y / graph.ratio))
|
||||
graph.draw(screen, x, y, time_scale)
|
||||
|
||||
volume = sensor.testSensor1(particle.distance, particle, scale, screen)
|
||||
print(volume)
|
||||
|
||||
graph.add_data(time, volume)
|
||||
# pygame.draw.circle(screen, (150,255,10), (x / 2, y /2), 3 * pow(10, -6) / scale)
|
||||
|
||||
pygame.draw.line(screen, (255,255,255), (x - (x * .1), y - (y * .1)), (scale_bar_end_point, y - (y * .1)))
|
||||
|
||||
# print((1 *pow(10, -6)) / scale)
|
||||
|
||||
time += time_scale
|
||||
|
||||
pygame.display.update()
|
||||
29
Fall 2024/Research/pygameSim/CytoSim/particle.py
Normal file
29
Fall 2024/Research/pygameSim/CytoSim/particle.py
Normal file
@ -0,0 +1,29 @@
|
||||
import math
|
||||
import pygame
|
||||
|
||||
class Particle:
|
||||
def __init__(self, speed, size, perm, rest):
|
||||
self.speed = speed
|
||||
self.size = size
|
||||
self.radius = size / 2
|
||||
self.perm = perm
|
||||
self.rest = rest
|
||||
self.volume = (4/3.0) * math.pi * pow(self.radius, 3)
|
||||
self.distance = 0
|
||||
|
||||
def move(self, time_interval, scale, left_limit, right_limit, screen, height):
|
||||
self.distance += (self.speed * time_interval) / scale
|
||||
self.pixel_distance = self.distance + left_limit
|
||||
if self.distance + left_limit + (self.size / (2 * scale)) > right_limit:
|
||||
self.distance = 0
|
||||
pygame.draw.circle(screen, (255,225,255), (left_limit + self.distance, height / 2), self.size / (2 * scale))
|
||||
|
||||
def partialVol(self, height):
|
||||
partialVol = (1/3) * math.pi * height * height * ((3 * self.size) - height)
|
||||
return partialVol
|
||||
|
||||
def updateSize(self, size):
|
||||
self.size = size
|
||||
self.volume = (4/3) * math.pi * size * size * size
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
129
Fall 2024/Research/pygameSim/CytoSim/sensor.py
Normal file
129
Fall 2024/Research/pygameSim/CytoSim/sensor.py
Normal file
@ -0,0 +1,129 @@
|
||||
import pygame
|
||||
import math
|
||||
|
||||
class Sensor:
|
||||
def __init__(self, width, distance, space):
|
||||
self.width = width
|
||||
self.distance = distance
|
||||
self.space = space
|
||||
self.volume = width * pow(distance, 2)
|
||||
self.total_width = (4 * width) + space
|
||||
self.total_height = 100 * pow(10, -6) - distance
|
||||
|
||||
def display(self, screenWidth, screenHeight, screen, scale):
|
||||
center_x = screenWidth / 2
|
||||
center_y = screenHeight / 2
|
||||
scaled_half_x = self.total_width / (2 * scale)
|
||||
scaled_half_y = self.total_height / (2 * scale)
|
||||
scaled_width = self.width / scale
|
||||
scaled_distance = self.distance / scale
|
||||
scaled_space = self.space / scale
|
||||
self.height = screenHeight
|
||||
|
||||
self.scaled_sensor1_left_limit = center_x - scaled_space - scaled_width
|
||||
self.scaled_sensor1_right_limit = center_x - scaled_space
|
||||
self.scaled_sensor2_left_limit = center_x + scaled_space
|
||||
self.scaled_sensor2_right_limit = center_x + scaled_space + scaled_width
|
||||
|
||||
self.right_limit = center_x + scaled_half_x
|
||||
self.left_limit = center_x - scaled_half_x
|
||||
|
||||
sensor1_rect_up = pygame.Rect(center_x - scaled_space - scaled_width, center_y - scaled_half_y, scaled_width, scaled_half_y - (scaled_distance / 2))
|
||||
sensor1_rect_down = pygame.Rect(center_x - scaled_space - scaled_width, center_y + (scaled_distance / 2), scaled_width, scaled_half_y - (scaled_distance / 2))
|
||||
sensor2_rect_up = pygame.Rect(center_x + scaled_space, center_y - scaled_half_y, scaled_width, scaled_half_y - (scaled_distance / 2))
|
||||
sensor2_rect_down = pygame.Rect(center_x + scaled_space, center_y + (scaled_distance / 2), scaled_width, scaled_half_y - (scaled_distance / 2))
|
||||
|
||||
pygame.draw.rect(screen, (0,200,0), sensor1_rect_up)
|
||||
pygame.draw.rect(screen, (0,200,0), sensor1_rect_down)
|
||||
pygame.draw.rect(screen, (0,200,0), sensor2_rect_up)
|
||||
pygame.draw.rect(screen, (0,200,0), sensor2_rect_down)
|
||||
|
||||
pygame.draw.line(screen, (100,100,50), (center_x - scaled_half_x, center_y - (scaled_distance / 2)), (center_x + scaled_half_x, center_y - (scaled_distance / 2)))
|
||||
pygame.draw.line(screen, (100,100,50), (center_x - scaled_half_x, center_y + (scaled_distance / 2)), (center_x + scaled_half_x, center_y + (scaled_distance / 2)))
|
||||
|
||||
pygame.draw.line(screen, (255,255,255), (center_x - scaled_half_x, center_y - scaled_half_y), (center_x + scaled_half_x, center_y - scaled_half_y), 7)
|
||||
pygame.draw.line(screen, (255,255,255), (center_x + scaled_half_x, center_y - scaled_half_y), (center_x + scaled_half_x, center_y + scaled_half_y), 7)
|
||||
pygame.draw.line(screen, (255,255,255), (center_x + scaled_half_x, center_y + scaled_half_y), (center_x - scaled_half_x, center_y + scaled_half_y), 7)
|
||||
pygame.draw.line(screen, (255,255,255), (center_x - scaled_half_x, center_y + scaled_half_y), (center_x - scaled_half_x, center_y - scaled_half_y), 7)
|
||||
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def testSensor1(self, partCenter, particle, scale, screen):
|
||||
particle_right_limit = particle.pixel_distance + (particle.radius / scale)
|
||||
particle_left_limit = particle.pixel_distance - (particle.radius / scale)
|
||||
|
||||
pygame.draw.line(screen, (0,0,0), (particle_left_limit, self.height), (particle_left_limit, 0))
|
||||
pygame.draw.line(screen, (0,100,0), (particle_right_limit, self.height), (particle_right_limit, 0))
|
||||
|
||||
pygame.draw.line(screen, (0,0,0), (self.scaled_sensor1_left_limit, self.height), (self.scaled_sensor1_left_limit, 0))
|
||||
pygame.draw.line(screen, (0,100,0), (self.scaled_sensor1_right_limit, self.height), (self.scaled_sensor1_right_limit, 0))
|
||||
|
||||
if (particle_right_limit >= self.scaled_sensor1_left_limit and particle_left_limit < self.scaled_sensor1_left_limit):
|
||||
if (particle.pixel_distance < self.scaled_sensor1_left_limit):
|
||||
height = particle_right_limit - self.scaled_sensor1_left_limit
|
||||
volume = ((math.pi * height * height) / 3) * ((3 * (particle.radius / scale)) - height)
|
||||
else:
|
||||
height = self.scaled_sensor1_left_limit - particle.pixel_distance
|
||||
volume = ((math.pi * height * height) / 3) * ((3 * (particle.radius / scale)) - height)
|
||||
elif (particle_right_limit <= self.scaled_sensor1_right_limit and particle_left_limit >= self.scaled_sensor1_left_limit):
|
||||
volume = particle.volume / scale
|
||||
elif (particle_right_limit > self.scaled_sensor1_right_limit and particle_left_limit > self.scaled_sensor1_left_limit and particle_left_limit < self.scaled_sensor1_right_limit):
|
||||
if (particle.pixel_distance > self.scaled_sensor1_right_limit):
|
||||
height = particle.pixel_distance - self.scaled_sensor1_right_limit
|
||||
volume = ((math.pi * height * height) / 3) * ((3 * (particle.radius / scale)) - height)
|
||||
else:
|
||||
height = self.scaled_sensor1_right_limit - particle_left_limit
|
||||
volume = ((math.pi * height * height) / 3) * ((3 * (particle.radius / scale)) - height)
|
||||
else:
|
||||
volume = 0
|
||||
|
||||
|
||||
return volume * scale
|
||||
|
||||
|
||||
|
||||
def testSensor2(self, partCenter, particle):
|
||||
if (particle.size >= abs(self.inner2 - (partCenter - particle.size))) and (particle.size >= abs(self.outer2 - (partCenter - particle.size))):
|
||||
volume = ((particle.volume / 2) - (particle.partialVol(particle.size - ((partCenter - particle.size) - self.inner2)))) + ((particle.volume / 2) - particle.partialVol(particle.size - (self.outer2 - (partCenter - particle.size))))
|
||||
return volume
|
||||
elif particle.size >= abs(self.inner2 - (partCenter - particle.size)):
|
||||
volume = particle.partialVol(particle.size - (self.inner2 - (partCenter - particle.size)))
|
||||
return volume
|
||||
elif particle.size >= abs(self.outer2 - (partCenter - particle.size)):
|
||||
volume = particle.volume - particle.partialVol(particle.size - (self.outer2 - (partCenter - particle.size)))
|
||||
return volume
|
||||
elif ((partCenter - particle.size) >= self.inner2 and (partCenter - particle.size) <= self.outer2):
|
||||
volume = particle.volume
|
||||
return volume
|
||||
else:
|
||||
return 0
|
||||
|
||||
def getParticleVolume(self, partCenter, particle):
|
||||
volume1 = self.testSensor1(partCenter, particle)
|
||||
#volume1 = 0
|
||||
volume2 = self.testSensor2(partCenter, particle)
|
||||
|
||||
if volume1:
|
||||
return volume1
|
||||
elif volume2:
|
||||
return volume2
|
||||
else:
|
||||
return 0
|
||||
|
||||
def whichSensor(self, partCenter, particle):
|
||||
volume1 = self.testSensor1(partCenter, particle)
|
||||
#volume1 = 0
|
||||
volume2 = self.testSensor2(partCenter, particle)
|
||||
|
||||
if volume1:
|
||||
return 1
|
||||
elif volume2:
|
||||
return 2
|
||||
else:
|
||||
return 0
|
||||
|
||||
def inputVoltage(self, voltage1, voltage2):
|
||||
self.voltage1 = voltage1
|
||||
self.voltage2 = voltage2
|
||||
36
Fall 2024/Research/pygameSim/CytoSim/slider.py
Normal file
36
Fall 2024/Research/pygameSim/CytoSim/slider.py
Normal file
@ -0,0 +1,36 @@
|
||||
import pygame
|
||||
|
||||
WHITE = (255, 255, 255)
|
||||
GRAY = (200, 200, 200)
|
||||
BLACK = (0, 0, 0)
|
||||
RED = (255, 0, 0)
|
||||
|
||||
class Slider:
|
||||
|
||||
def __init__(self, x, y, w, h, min_val, max_val, initial_val):
|
||||
self.rect = pygame.Rect(x, y, w, h)
|
||||
self.min_val = min_val
|
||||
self.max_val = max_val
|
||||
self.value = initial_val
|
||||
self.grabbed = False
|
||||
|
||||
def draw(self, screen):
|
||||
# Draw the background
|
||||
pygame.draw.rect(screen, GRAY, self.rect)
|
||||
# Draw the handle (circle)
|
||||
handle_x = self.rect.x + (self.value - self.min_val) / (self.max_val - self.min_val) * self.rect.width
|
||||
pygame.draw.circle(screen, RED, (int(handle_x), self.rect.centery), self.rect.height // 2)
|
||||
|
||||
def handle_event(self, event):
|
||||
print("hi")
|
||||
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||
if self.rect.collidepoint(event.pos):
|
||||
self.grabbed = True
|
||||
elif event.type == pygame.MOUSEBUTTONUP:
|
||||
self.grabbed = False
|
||||
elif event.type == pygame.MOUSEMOTION:
|
||||
if self.grabbed:
|
||||
mouse_x = event.pos[0]
|
||||
# Constrain the handle within the slider
|
||||
new_value = (mouse_x - self.rect.x) / self.rect.width * (self.max_val - self.min_val) + self.min_val
|
||||
self.value = max(self.min_val, min(self.max_val, new_value))
|
||||
BIN
Fall 2024/Research/pygameSim/pics/Figure_1.png
Normal file
BIN
Fall 2024/Research/pygameSim/pics/Figure_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
BIN
Fall 2024/csci218/Labs/Final Project/MenuTest/.DS_Store
vendored
Normal file
BIN
Fall 2024/csci218/Labs/Final Project/MenuTest/.DS_Store
vendored
Normal file
Binary file not shown.
542
Fall 2024/csci218/Labs/Final Project/MenuTest/MenuTest.ino
Normal file
542
Fall 2024/csci218/Labs/Final Project/MenuTest/MenuTest.ino
Normal file
@ -0,0 +1,542 @@
|
||||
#define outputA 6
|
||||
#define outputB 7
|
||||
#define buttonPin 8
|
||||
#define lightPin 13
|
||||
#define waterLPin 10
|
||||
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
int waterPin = A0;
|
||||
int pinValue, pinValueVolt;
|
||||
float waterPer;
|
||||
|
||||
int counter = 0;
|
||||
int aState;
|
||||
int aLastState;
|
||||
int bState;
|
||||
int bLastState;
|
||||
int buttonState;
|
||||
int lastButtonState;
|
||||
|
||||
int hourTen = 0;
|
||||
int hourOne = 0;
|
||||
int minTen = 0;
|
||||
int minOne = 0;
|
||||
|
||||
int hourTenL = 1;
|
||||
int hourOneL = 0;
|
||||
int minTenL = 0;
|
||||
int minOneL = 0;
|
||||
|
||||
int minWaterTen = 8;
|
||||
int minWaterOne = 2;
|
||||
int minWater = (minWaterTen * 10) + minWaterOne;
|
||||
|
||||
int timeScale = 1;
|
||||
int timePassed = 0;
|
||||
|
||||
|
||||
long unsigned int hourSec = ((hourTenL * 10) + hourOneL) * 60;
|
||||
long unsigned int lightOnSec = (hourSec + ((minTenL * 10) + minOneL)) * 60;
|
||||
long unsigned int scaledLightOnSec;
|
||||
long unsigned int scaledLightOffSec;
|
||||
|
||||
unsigned long secDay;
|
||||
unsigned long secLeft;
|
||||
|
||||
long unsigned int preTime;
|
||||
long unsigned int currTime;
|
||||
|
||||
bool flipOn = true;
|
||||
|
||||
char menuList[][10] = {"View", "Water", "Light", "Flip"};
|
||||
|
||||
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
|
||||
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
|
||||
|
||||
int subTimeMenu(int pos, int val, int condVal = 0);
|
||||
int adjustHourTen(int val);
|
||||
int adjustHourOne(int val, int condVal);
|
||||
int adjustMinTen(int val);
|
||||
int adjustMinOne(int val);
|
||||
|
||||
void setup() {
|
||||
// put your setup code here, to run once:
|
||||
pinMode(outputA, INPUT_PULLUP);
|
||||
pinMode(outputB, INPUT_PULLUP);
|
||||
pinMode(buttonPin, INPUT_PULLUP);
|
||||
pinMode(lightPin, OUTPUT);
|
||||
pinMode(waterLPin, OUTPUT);
|
||||
hourSec = ((hourTenL * 10) + hourOneL) * 60;
|
||||
lightOnSec = (hourSec + ((minTenL * 10) + minOneL)) * 60;
|
||||
|
||||
Serial.begin(9600);
|
||||
aLastState = digitalRead(outputA);
|
||||
lcd.begin(16, 2);
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(menuList[0]);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
|
||||
updateInputVals();
|
||||
delay(50);
|
||||
|
||||
secDay = 86400 / timeScale;
|
||||
scaledLightOnSec = lightOnSec / timeScale;
|
||||
scaledLightOffSec = secDay - scaledLightOnSec;
|
||||
|
||||
pinValue = analogRead(waterPin);
|
||||
pinValueVolt = (5.0 / 1023) * pinValue;
|
||||
waterPer = 100 - (((pinValue - 200) / (float)(700)) * 100);
|
||||
|
||||
Serial.print("Water Per: ");
|
||||
Serial.print(waterPer);
|
||||
|
||||
currTime = millis();
|
||||
|
||||
if (currTime - preTime >= 1000) {
|
||||
preTime = currTime;
|
||||
timePassed++;
|
||||
}
|
||||
|
||||
if (waterPer < minWater) {
|
||||
digitalWrite(waterLPin, HIGH);
|
||||
|
||||
} else {
|
||||
digitalWrite(waterLPin, LOW);
|
||||
}
|
||||
|
||||
|
||||
if (!secLeft) {
|
||||
flipOn =!flipOn;
|
||||
toggleLight();
|
||||
timePassed = 0;
|
||||
}
|
||||
|
||||
if (flipOn) {
|
||||
Serial.print(" Light off ");
|
||||
secLeft = secDay - scaledLightOffSec - timePassed;
|
||||
} else {
|
||||
Serial.print(" Light on ");
|
||||
secLeft = secDay - scaledLightOnSec - timePassed;
|
||||
}
|
||||
|
||||
|
||||
if (!counter) {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("Moisture: ");
|
||||
lcd.print(waterPer);
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("Time: ");
|
||||
float hours = secLeft / (float)3600;
|
||||
Serial.print("Hours left: ");
|
||||
Serial.println(hours);
|
||||
if (hours <= 9) {
|
||||
lcd.print("0");
|
||||
}
|
||||
lcd.print(hours);
|
||||
if (flipOn) {
|
||||
lcd.print(" on ");
|
||||
} else {
|
||||
lcd.print(" off");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!aState && aState != aLastState) {
|
||||
counter++;
|
||||
if (counter > 3) {
|
||||
counter = 0;
|
||||
}
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(menuList[counter]);
|
||||
}
|
||||
|
||||
if (!bState && bState != bLastState) {
|
||||
counter--;
|
||||
if (counter < 0) {
|
||||
counter = 3;
|
||||
}
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print(menuList[counter]);
|
||||
}
|
||||
|
||||
if (!buttonState && buttonState != lastButtonState) {
|
||||
switch (counter) {
|
||||
case 0:
|
||||
toggleLight();
|
||||
break;
|
||||
case 1:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
waterMenu();
|
||||
lcd.print(menuList[counter]);
|
||||
break;
|
||||
case 2:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
timeMenu();
|
||||
lcd.print(menuList[counter]);
|
||||
break;
|
||||
case 3:
|
||||
toggleLight();
|
||||
flipOn = !flipOn;
|
||||
timePassed = 0;
|
||||
counter = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
updatePreInputVals();
|
||||
|
||||
}
|
||||
|
||||
void waterMenu() {
|
||||
|
||||
lcd.clear();
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.blink();
|
||||
lcd.print("Min Per: ");
|
||||
lcd.print(minWaterTen);
|
||||
lcd.print(minWaterOne);
|
||||
lcd.print(" x");
|
||||
|
||||
int posI[] = {9, 10, 12};
|
||||
int pos = 0;
|
||||
|
||||
int loop = 1;
|
||||
|
||||
while (loop) {
|
||||
updateInputVals();
|
||||
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
|
||||
lcd.setCursor(9, 0);
|
||||
lcd.print(minWaterTen);
|
||||
lcd.print(minWaterOne);
|
||||
lcd.print(" x");
|
||||
lcd.setCursor(posI[pos], 0);
|
||||
delay(50);
|
||||
|
||||
if (a) {
|
||||
pos++;
|
||||
if (pos > 2) {
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (b) {
|
||||
pos--;
|
||||
if (pos < 0) {
|
||||
pos = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (button) {
|
||||
switch (pos) {
|
||||
case 0:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
minWaterTen = adjustMinOne(minWaterTen, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 1:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
minWaterOne = adjustMinOne(minWaterOne, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 2:
|
||||
loop = 0;
|
||||
minWater = (minWaterTen * 10) + minWaterOne;
|
||||
delay(150);
|
||||
lcd.noBlink();
|
||||
lcd.clear();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
updatePreInputVals();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void toggleLight() {
|
||||
digitalWrite(lightPin, LOW);
|
||||
delay(50);
|
||||
digitalWrite(lightPin, HIGH);
|
||||
delay(50);
|
||||
digitalWrite(lightPin, LOW);
|
||||
}
|
||||
|
||||
void timeMenu() {
|
||||
lcd.setCursor(0, 0);
|
||||
lcd.print("Time On: ");
|
||||
lcd.blink();
|
||||
int loop = 1;
|
||||
int posI[] = {9, 10, 12, 13, 15};
|
||||
int pos = 0;
|
||||
while (loop) {
|
||||
updateInputVals();
|
||||
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
|
||||
lcd.setCursor(9, 0);
|
||||
lcd.print(hourTenL);
|
||||
lcd.print(hourOneL);
|
||||
lcd.print(":");
|
||||
lcd.print(minTenL);
|
||||
lcd.print(minOneL);
|
||||
lcd.print(" x");
|
||||
lcd.setCursor(posI[pos], 0);
|
||||
delay(50);
|
||||
|
||||
if (a) {
|
||||
pos++;
|
||||
if (pos > 4) {
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (b) {
|
||||
pos--;
|
||||
if (pos < 0) {
|
||||
pos = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (button) {
|
||||
switch (pos) {
|
||||
case 0:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
hourTenL = adjustHourTen(hourTenL, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 1:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
hourOneL = adjustHourOne(hourOneL, hourTenL, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 2:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
minTenL = adjustMinTen(minTenL, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 3:
|
||||
buttonState = 2;
|
||||
lastButtonState = 0;
|
||||
minOneL = adjustMinOne(minOneL, posI[pos]);
|
||||
pos++;
|
||||
break;
|
||||
case 4:
|
||||
loop = 0;
|
||||
hourSec = ((hourTenL * 10) + hourOneL) * 60;
|
||||
lightOnSec = (hourSec + ((minTenL * 10) + minOneL)) * 60;
|
||||
timePassed =0;
|
||||
if (!lightOnSec) {
|
||||
lightOnSec = 1;
|
||||
}
|
||||
delay(50);
|
||||
lcd.noBlink();
|
||||
lcd.clear();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
updatePreInputVals();
|
||||
}
|
||||
}\
|
||||
|
||||
int adjustHourTen(int val, int col) {
|
||||
|
||||
while(1) {
|
||||
updateInputVals();
|
||||
delay(20);
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
if (a) {
|
||||
val++;
|
||||
if (val > 2) {
|
||||
val = 0;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
val--;
|
||||
if (val < 0) {
|
||||
val = 2;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (button) {
|
||||
return val;
|
||||
}
|
||||
|
||||
updatePreInputVals();
|
||||
}
|
||||
}
|
||||
|
||||
int adjustHourOne(int val, int hr, int col) {
|
||||
while(1) {
|
||||
updateInputVals();
|
||||
delay(20);
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
int max = 9;
|
||||
|
||||
if (hr == 2) {
|
||||
max = 3;
|
||||
}
|
||||
|
||||
if (a) {
|
||||
val++;
|
||||
if (val > max) {
|
||||
val = 0;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
val--;
|
||||
if (val < 0) {
|
||||
val = max;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (button) {
|
||||
return val;
|
||||
}
|
||||
|
||||
updatePreInputVals();
|
||||
}
|
||||
}
|
||||
|
||||
int adjustMinTen(int val, int col) {
|
||||
while(1) {
|
||||
updateInputVals();
|
||||
delay(20);
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
if (a) {
|
||||
val++;
|
||||
if (val > 5) {
|
||||
val = 0;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
val--;
|
||||
if (val < 0) {
|
||||
val = 5;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (button) {
|
||||
return val;
|
||||
}
|
||||
|
||||
updatePreInputVals();
|
||||
}
|
||||
}
|
||||
|
||||
int adjustMinOne(int val, int col) {
|
||||
while(1) {
|
||||
updateInputVals();
|
||||
|
||||
delay(20);
|
||||
bool a = checkInput(aState, aLastState);
|
||||
bool b = checkInput(bState, bLastState);
|
||||
bool button = checkInput(buttonState, lastButtonState);
|
||||
|
||||
if (a) {
|
||||
val++;
|
||||
|
||||
if (val > 9) {
|
||||
val = 0;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (b) {
|
||||
val--;
|
||||
if (val < 0) {
|
||||
val = 9;
|
||||
}
|
||||
lcd.setCursor(col, 0);
|
||||
lcd.print(val);
|
||||
lcd.setCursor(col, 0);
|
||||
}
|
||||
|
||||
if (button) {
|
||||
return val;
|
||||
}
|
||||
|
||||
updatePreInputVals();
|
||||
}
|
||||
}
|
||||
|
||||
void updateInputVals() {
|
||||
buttonState = digitalRead(buttonPin);
|
||||
aState = digitalRead(outputA);
|
||||
bState = digitalRead(outputB);
|
||||
}
|
||||
|
||||
void updatePreInputVals() {
|
||||
lastButtonState = buttonState;
|
||||
aLastState = aState;
|
||||
bLastState = bState;
|
||||
}
|
||||
|
||||
bool checkInput(int currVal, int preVal) {
|
||||
if (!currVal && currVal != preVal) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
12
Fall 2024/csci218/Labs/Final Project/Resouces.txt
Normal file
12
Fall 2024/csci218/Labs/Final Project/Resouces.txt
Normal file
@ -0,0 +1,12 @@
|
||||
Software used:
|
||||
Fusion 360: https://www.autodesk.com/education/edu-software/overview#
|
||||
Tinkercad: https://www.tinkercad.com
|
||||
|
||||
Guide:
|
||||
You'll have to make a education account with your school email, then go to the Autodesk website. From there select the products tab then under discover select educational access. Once on that page click on get products and that should bring you to the download page of both tinkercad and fusion.
|
||||
|
||||
Resources:
|
||||
I learned how to model from Dr. Shi's ENGR 111 class, but also https://youtube.com/playlist?list=PLrZ2zKOtC_-C4rWfapgngoe9o2-ng8ZBr&si=t8OCywQ_BrDHN1RU is good resource.
|
||||
For tinkercad i just messed around to figure it our so I cant help much there.
|
||||
|
||||
Garrett Haldrup
|
||||
@ -45,4 +45,5 @@ void loop() {
|
||||
|
||||
lastButtonState = buttonState;
|
||||
aLastState = aState;
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 13 MiB After Width: | Height: | Size: 13 MiB |
BIN
Fall 2024/csci218/Labs/Lab12/a.out
Executable file
BIN
Fall 2024/csci218/Labs/Lab12/a.out
Executable file
Binary file not shown.
119
Fall 2024/csci218/Labs/Lab12/lab12.c
Normal file
119
Fall 2024/csci218/Labs/Lab12/lab12.c
Normal file
@ -0,0 +1,119 @@
|
||||
/* Name: Garrett Haldrup
|
||||
# lab12.c
|
||||
# Purpose: Solves problems assigned in Lab 12
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
int goodLogin();
|
||||
int createExpression(char expr[]);
|
||||
|
||||
/* add your function declaration here... */
|
||||
int main() {
|
||||
|
||||
srand((int)time(0));
|
||||
|
||||
char expr[15] = "";
|
||||
int try = 0;
|
||||
|
||||
printf("\nTest goodInput().....\n");
|
||||
//int try = goodLogin();
|
||||
if (try == 1) {
|
||||
printf("\nTest Good\n");
|
||||
} else {
|
||||
printf("\nTest Failed\n");
|
||||
}
|
||||
/* put your test cases here...*/
|
||||
|
||||
|
||||
|
||||
printf("\nTest createExpression().....\n");
|
||||
/* put your test cases here...*/
|
||||
int key = createExpression(expr);
|
||||
printf("%s = %d\n", expr, key);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* add your function definition here... */
|
||||
int goodLogin() {
|
||||
int tries = 5;
|
||||
char user[] = "csci218";
|
||||
char userEnter[50];
|
||||
char pass[] = "grace2023F";
|
||||
char passEnter[50];
|
||||
|
||||
printf("Please enter username then password, only 5 attempts\n\n");
|
||||
while(1) {
|
||||
if (tries < 5) {
|
||||
printf("Incorrect username or password\n");
|
||||
printf("%d attempts left\n", tries);
|
||||
}
|
||||
printf("Please enter username: ");
|
||||
scanf("%s", userEnter);
|
||||
printf("Please enter password: ");
|
||||
scanf("%s", passEnter);
|
||||
|
||||
if (!strcmp(user, userEnter) && !strcmp(pass, passEnter)) {
|
||||
return 1;
|
||||
}
|
||||
tries--;
|
||||
if (!tries) {
|
||||
printf("Login failed, used all atempts\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int createExpression(char expr[]) {
|
||||
char operators[][3] = {"+", "-", "/", "%", ">", "<", "=="};
|
||||
|
||||
int num1 = (rand() % 31) + 20;
|
||||
int num2 = (rand() % 31) + 20;
|
||||
|
||||
int indexer = rand() % 7;
|
||||
sprintf(expr, "%d %s %d", num1, operators[indexer], num2);
|
||||
|
||||
int sol;
|
||||
|
||||
switch (indexer) {
|
||||
case 0:
|
||||
sol = num1 + num2;
|
||||
break;
|
||||
case 1:
|
||||
sol = num1 - num2;
|
||||
break;
|
||||
case 2:
|
||||
if (!num2) {
|
||||
sol = 999999;
|
||||
} else {
|
||||
sol = num1 / num2;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (!num2) {
|
||||
sol = 999999;
|
||||
} else {
|
||||
sol = num1 % num2;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
sol = num1 > num2;
|
||||
break;
|
||||
case 5:
|
||||
sol = num1 < num2;
|
||||
break;
|
||||
case 6:
|
||||
sol = num1 == num2;
|
||||
break;
|
||||
}
|
||||
|
||||
return sol;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user